[TYPO3-mvc] Fluid: Complex forms best practice
Bastian Waidelich
bastian at typo3.org
Fri Jul 10 10:16:21 CEST 2009
Sebastian Kurfürst wrote:
Hi Sebastian,
>> That does not work currently, cause the property mapper tries to
>> instantiate a class of type "array"..
> Yes, we should make this work (in FLOW3 and in Extbase) - first in
> FLOW3, and then backport it.
> However, I think the use cases for this are rather limited [...]
You're right. Arrays would be difficult to validate and we don't want
the users to do
if (!$formData['tos']) { $this->view->assign('error', 'you have to
accept the TOS').....
in their controllers ;)
So after thinking about it again yesterday, I came to the same outcome:
we need to support multiple objects per form.
> I just had the idea of introducing another Fluid tag:
> <f:form.objectContainer>
Yes, that's a nice idea. I thought about just adding an
"object"-argument to AbstractFormViewHelper enabling you to overwrite
the bound object for every form element. But that would lead to a lot of
duplicated code in the templates and you'd have to specify the object
name additionally somehow.
So I like the idea in general even though the naming is not perfect yet
and IMO it does not need to be a form view helper. It could make sense
to setup "object scopes" in other situations too - does it?
What about
<f:bindTo object="foo" as="bar">
<f:scope object="foo" name="bar">
mh, don't know...
Bastian
More information about the TYPO3-project-typo3v4mvc
mailing list