[TYPO3-mvc] Complex array validation

Jacob Rasmussen jacob at lightbulb.dk
Mon Feb 6 21:24:12 CET 2012

Hi list,

I'm currently working on a TYPO3 4.6 project where I have to create a 
booking/inquiry form with some static data, a wish list and a list of 
participating persons.
The two lists are mapped as objectstorage in the model and frontend 
users are able to add any number of wishes and persons to the fluid form.

A participating person has two attributes, name and age and a wish has 3 
attributes, a house, an arrival and departure date, so AFAIK I can't map 
these fields directly to my inquiry model, and get them validated this 
way, as the frontend users can add an arbitrary number of persons and 
So I'm currently sending the wish and person data in separate parts of 
my form array like this:

<f:form.textfield name="wishes[house][] />
<f:form.textfield name="wishes[arrival][] />
<f:form.textfield name="wishes[departure][] />

<f:form.textfield name="persons[name][] />
<f:form.textfield name="persons[age][] />

Now I would like to get these data validated correctly and trigger the 
errorAction correctly whenever one or the wishes or persons doesn't 
match my model validation rules.

I've thought of using the propertymapper in my controller, but I can't 
really figure out how to trigger errors correctly - so I would like to 
know if there is another (and better) way of mapping properties to the 
form and sending it to the controller.

The frontend functionality should more or less reflect IRRE handling in 
the backend, I just need to wrap my head around it...

Any suggestions?

Kind regards

Jacob Rasmussen
Certified TYPO3 Integrator

More information about the TYPO3-project-typo3v4mvc mailing list