[FLOW3-general] Validation and flashMessages
Bastian Waidelich
bastian at typo3.org
Thu Feb 14 15:18:49 CET 2013
Rudy Gnodde wrote:
Hi Rudy,
> 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()".
To avoid this technical error message, simply override the method
getErrorFlashMessage() in your (abstract) controller and return FALSE
(see [1]).
> 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?
When there are validation errors you *are* redirected to the previous
action. Unlike Extbase, by default Flow won't re-submit the previously
submitted mapped data though (I guess this will change in Extbase, too).
The Fluid Form ViewHelpers take care of redisplaying the submitted data,
if you use them correctly:
<f:form action="create" objectName="newContact">
<f:form.textfield property="firstName" />
</f:form>
BTW: Fluid will also give the rendered input field a CSS class if the
related property contained validation errors
[1]
http://git.typo3.org/FLOW3/Packages/TYPO3.FLOW3.git/blob/HEAD:/Classes/TYPO3/Flow/Mvc/Controller/ActionController.php#l411
HTH
--
Bastian Waidelich
--
Core Developer Team
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the FLOW3-general
mailing list