[TYPO3-mvc] Is there a way to sort the validation result?

Helmut Hummel helmut.hummel at typo3.org
Tue Oct 21 17:31:24 CEST 2014


On 16.09.14 08:04, Stefan Kruse wrote:
> Hi,
>
> when i submit a normal form the assigned object is validated correctly and the validation result messages are in the same order like the form fields. In my case i have a captcha field as last field in the form. When i now add a special/own validator to this field, the error message appears at the top of all other messages. I found this not good. It would be better if the messages are appear in the same order like the fields in the form.
>
> Is there a way to sort the error messages in the same order like the fields?

If you need a specifc order, you must specify this order in your 
template using the validation result view helper. The view helper can 
render a result for a specific property.

Here is an example by using a partial:

https://gist.github.com/helhum/884928ba589f5e28e6b7

The example is not optimal as it always renders the named fields even if 
no error occurs, but you should get the idea.

Kind regards,
Helmut

-- 
Helmut Hummel
Release Manager TYPO3 6.0
TYPO3 CMS Active Contributor, TYPO3 Security Team Member

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-project-typo3v4mvc mailing list