[TYPO3-mvc] How to reload a page with a form?

Claus Due claus at wildside.dk
Fri Aug 3 13:55:35 CEST 2012


Hi Robert,

In builetpoints:

* your form method must accept an object argument
* the object must be an Entity which has @validate annotations OR
* the object must have a custom validator
* the method must not validate the object and default value must be NULL
* if on 4.5 and using form checkboxes, check if object is null and create a new instance (to support checkboxes in forms)
* the arguments default value must be null
* the method that accepts the form must be another method
* the method that accepts must perform validation

What will happen is your form will post to the accepting method which will validate and then forward the request back to the form method but this time with the object (that has errors) as an argument that now will be displayed in the form.

All examples for Extbase and validation of form objects use this approach; it should be fairly easy to dig out an extension which contains Extbase validation.

Cheers,
Claus

On Aug 3, 2012, at 12:53 PM, Robert Schneider <r.schneider at artworx.at> wrote:

> I have an own registration form which I want to reload if the data is not valid. The form uses the object, and the input fields the property attributes. With the first call no object is given, obviously, and all fields are empty. Now, if the page is reloaded, what do I have to do that the fields get refilled with the already entered data?
> 
> Do I have to use redirect or forward for loading the same page? How do I have to provide the arguments?
> 
> What I also would like to achieve is that some warn messages (array) gets displayed. How does this get realized?
> 
> If anyone could give me an example, please. It cannot be that difficult but I really don't get it work after hours by myself.
> 
> Thanks in advance (I'm off for the next two weeks)!
> Robert
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list