[TYPO3-mvc] Fluid: Complex forms best practice
Sebastian Kurfürst
sebastian at typo3.org
Thu Jul 9 07:59:50 CEST 2009
Hi Nikolas,
> The most obvious solution for such a scenario is to forgo all fluid magic
> (field population, validation etc).
>
> This means put everything to a huge data container (tx_foo[data][xyz]) pass
> it over to the controller and process it manually.
Nooo, that's not nice at all :-)
> One that came to my mind was to create a non-persistent meta "registration
> object"
> but I am not sure yet it this is a passable solution. Any comments on this?
I guess this would work, but is not that nice...
Did you try the following:
Inside your fluid template:
<f:form action="create" name="newUser" object="{newUser}">
<!-- bind an object to the form -->
<f:form.textbox property="name" />
<!-- have some fields with magic :-) -->
<f:form.textbox name="age" />
<!-- a field which should not belong to newUser -->
</f:form>
then, inside your controller, try the following:
/**
* @param ...User $newUser
* @param integer $age The age of the person
public function createAction($newUser, $age) {
...
}
This *should* work, though I did not test it right now.
- Does it sound intuitive to you?
- Could you please test it and give feedback if it works? If not, we
need to fix that :-)
Greets,
Sebastian
More information about the TYPO3-project-typo3v4mvc
mailing list