Hi I have to show the validation error message when validation fails.But powermail returns an error message Validation failed while trying to call ....createAction();
How to redirect the page when validation fails?
I think you're writing about the serverside validation in powermail. There is nothing special - it's a normal Extbase validation behaviour. This means, that the validators will be checked before createAction() or confirmationAction(). If a validation fails, extbase will redirect the user to the last working action - in this case formAction() - and should show the errors above the rendered form.
So your problem is, that the form is rendered again but there are no error messages?
Related
I created a custom finisher for EXT:form. Among other things, my finisher has to show a flash message:
class CreateRequestActionFinisher extends \TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher
{
// Validations ...
$flashMessage = $this->objectManager->get(
FlashMessage::class,
'Everything is fine.',
'Thanks',
\TYPO3\CMS\Core\Messaging\AbstractMessage::OK,
true
);
$this->finisherContext->getControllerContext()->getFlashMessageQueue()->addMessage($flashMessage);
}
My problem is that, in frontend, my flash message does not appear inmediately when I send my form. When I refresh my browser page (sending my form twice), my flash message appears. ¿What can I do? Thanks.
Workaround for TYPO3 v8.7:
I think this is based on this open issue regarding caching of flash messages. As a workaround, I currently use this additional finisher (last one in finisher array) to get it working properly:
-
options:
pageUid: '1' # uid of the page with the form
additionalParameters: 'no_cache=1'
identifier: Redirect
TYPO3 v9.5.6 and newer:
I think that this problem has now been solved because of this patch and a workaround is no longer necessary.
I have a simple form which has only two(email, password) fields. I'm using codeigniter's form validation library to validate that form. And it's working fine, but not the way I wanted to.
I want to show only one error message when email or password field empty. or when both fields are empty. not two error messages for each fields.
How can I do that in codeigniter using it's form_validation library.
Use form_error() function http://www.codeigniter.com/user_guide/libraries/form_validation.html look up Showing Errors Individually
I'm developing an application with Symfony2 and I try to translate texts form validation (required). Validation is done by the browser and I get eg "Veuillez renseigner ce champs" I wish I could translate the customer or switch also navigation.
My forms are made with buidform.
Thank you in advance for your help
Olivier
If you are referring to the browser validation raised when a field has an attribute required, this does not depend on symfony. I'm not sure you can set a language for these messages as they are generated by the user's browser.
A solution for you might be to disable browser validation (ie set required to false in your formBuilder fields) and rely on Assertions in you entities whose messages you can customise, you'll find more about this here.
I have a simple form without a entity that I use to send emails. Now I was testing in firefox and if I leave a field empty I will get a message. But now if I open the same form in Safari (that ignores required proprty) I won't get any message. The form->isValid() returs true even when I leave all fields blank...
How to validate this?
The in-browser validation is just a time saver to avoid a request to a server when a field is blank, but it's not a proper validation because it can be disabled on the browser level. You still should validate on the server side.
See this section — you need the NotBlank constraint.
I have problem with form submission to a action of different moudule, say e.g I have a module called "mymobile" from I am calling a action in module "register" which will process the registration, if there is any error in form I am setting the error messages and forwarding to "mymobile" module's page from where I called the action of "register", so it is modifying the header and my Japanese text is getting converted to some junk. Is there any way I can show error messages on my form without change of text? Any alternative for $this->forward() method? I am using symfony 1.1 and I tried $this->rediect() it will refresh the page.
Thank you in advnace