[TYPO3-mvc] Validaton

Nikolas Hagelstein hagelstein at shr.cc
Thu Jul 9 17:04:23 CEST 2009


Hi,

I did some validation testing today. My overall goal was to use the extbase
 "/* @validation" scheme to face the user with a nice error page/section in
case form validation fails.
(something like Please correct your email address and enter a valid user
name).  
Unfortunatly I wasn't successful :|.

The 2 main issues I ran into where:
1. It seems as if validation stops after the first error that occurs.
So there is no way to get all errors at once, instead you just get the
first.
(see ArgumentsValidator.php::isValid).

2. The only way to catch an error an replace the default error message by a
custom one seems be to create ones own errorAction.
Which is quite ugly since the errors are hidden somewhere beyond the
ControllerContext.

I took a look into flow3 to see how they handle it but it's almost the same
except for the fact that there is a nice form error viewhelper in the most
recent fluid version.

So the only way to validate several arguments at once seems to be doing in
manually within your controller or to combine all arguments within one huge
container object and validate them via @validate $myFormArguments
Tx_myExt_Validation_MyformArgumentValidator.

Hopefully someone will disprove me ;).

Cheers,
Nikolas








More information about the TYPO3-project-typo3v4mvc mailing list