[FLOW3-general] Validation and flashMessages

Carsten Bleicker carsten at bleicker.de
Thu Feb 14 14:55:51 CET 2013


i also had this issue. fixed it by an abstract controller containing new errorAction
and an additional validation error behavior:

https://gist.github.com/pumatertion/4952982

Am 14.02.2013 um 14:48 schrieb David Sporer:

> Hi Rens,
> 
> I don't think that this is his problem.
> FLOW3/Flow is printing a default error message like "An error occurred while
> trying to call..." and the only way to get rid of this I (and Rudy) know is
> to override the getErrorFlashMessage method.
> 
> Means we know how to output the validation results but more than we want is
> shown.
> 
> Regards
> David
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: flow3-general-bounces at lists.typo3.org
> [mailto:flow3-general-bounces at lists.typo3.org] Im Auftrag von Rens Admiraal
> Gesendet: Donnerstag, 14. Februar 2013 11:57
> An: flow3-general at lists.typo3.org
> Betreff: Re: [FLOW3-general] Validation and flashMessages
> 
> Hey Rudy,
> 
> When the validation on the arguments fails you are actually redirected to
> the original action. This is working in Extbase like it is in Flow.
> 
> If you want to display the validation results of the form I would suggest
> using the validationResults viewhelper for that:
> http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartV/F
> luidViewHelperReference.html#f-form-validationresults
> 
> Hope this helps
> 
> Greetz,
> Rens
> 
> 
> Op 2/13/13 4:48 PM, Rudy Gnodde schreef:
>> Hello all,
>> 
>> I am trying to create a simple Contact book. Using kickstart I've 
>> created the Controller, Model, Repository, etc. This worked fine, but 
>> now I want to add basic validation (NotEmpty) to several fields. When 
>> I try to create a new Contact and leave those fields empty I get the 
>> expected "This property is required." messages, but I also get a 
>> flashMessage "An error occurred while trying to call 
>> Wind\Petear\Controller\ContactController->createAction()".
>> 
>> After searching the code and online for a while I found this happens 
>> when you call an action and the given parameters don't validate. The 
>> only way I've found to give a clean error is to override the default 
>> getErrorFlashMessage method in my controller, check which action was 
>> called and return a better error message.
>> 
>> Is this the correct way to do it? Shouldn't the browser be redirected 
>> back to the newAction like (I think) it is in Extbase?
>> 
>> Thanks,
>> 
>> Rudy Gnodde
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
> 
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general



More information about the FLOW3-general mailing list