[TYPO3-mvc] Fluid: Complex forms best practice

Nikolas Hagelstein lists at shr-now.de
Thu Jul 9 10:54:49 CEST 2009


Hi,
>Nooo, that's not nice at all :-)
Indeed :)

>> 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...

I played around with that  idea and created an entity called registration,
assigned properties, getters and setters to it and put together a controller
looking like this:
 --
/**
 * Test
 *
 * @param Tx_Myext_Domain_Model_Registration $registration
 * @return string An HTML form;
 */
public function testAction(Tx_Speach_Myext_Model_Registration $registration
= NULL)
--

While the template looks like:
--
<f:form method="post" controller="Register" action="test"
object="{registration}" name="registration">
...
---

This works for "auto fill in" but I don't know how to handle validation for
the properties of this object.
Adding some debug output to extbase unearth that objects get assigned
conjuction validator by default. Perhaps this is something to base on.

Further more I came across the fact that at least flow3 offers the
opportunity to specify custom validation objects
" * @validate $customer F3\Foo\Validator\PlatinumCustomerValidator"

Is extbase capable of a similar mechanism? 
If so, I could specify a validator Class for my "registration object"
(consisting e.g. of a user object and some additional informations).


>Did you try the following:
>Inside your fluid template:
>[form with object and standalone fields ...]
>This *should* work, though I did not test it right now.
Yes it works.
But this is not a viable solution since I got a bunch of fields and what I
wanted to avoid is to define all of them within the controller. Therefor I
raised the proposal of having a "registration" object.


>Does it sound intuitive to you?
It does for a small amount of additional fields.

>Could you please test it and give feedback if it works? If not, we 
>need to fix that :-)
It works :).

BTW: is there an extbase related IRC channel? #flow3 at freenode seems fairly
empty :)
Cheers,
Nikolas



More information about the TYPO3-project-typo3v4mvc mailing list