[TYPO3-mvc] Trouble with Form validation: Other field values are not restored

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon Aug 8 12:49:23 CEST 2011


Hey,

> When I submit the form, all fields are validated. If an error occurs, it's
> rendered and the unvalidated fields get the error class.
> So far so good :). What doesn't work: The form looses all other form field
> values - I guess the errorAction isn't forwarding the POST values
> of the other validated form fields. Is this the default behavior or can it
> be configured ?

well, how do you submit those other form fields? Do they belong to one 
and the same object, or are they separate? If they belong to the same 
object they should be filled automatically again. Just make sure you set 
the "object" attribute of the form viewHelper and pass your object to it 
to get that feature.

> My "workflow" is: Controller->newAction ->  Model Validation ->  createAction.
> So the createAction isn't called but the errorAction returns to the
> NewAction, but without the POSTed other field values. Why ?

same question as above - separate fields or one object with multiple 
properties? If you're create and new action should have the same method 
arguments (incoming parameters) everything should be fine. If you're new 
action doesn't accept any parameters (of course declared optional), the 
will be ignored. Also make sure to assign those to the view of your 
newAction of course in order to prefill the form.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list