[Flow] Form ViewHelper for property that is an array of strings
Christian Loock
chl at vkf-renzel.de
Thu Jul 24 13:14:06 CEST 2014
Hello,
I wonder if there is some sort of best practice for form fields, that
shall represent arrays of scalar types.
For example, in the Domain Model Foo, i have a property Bar, that is of
type array and should save strings. Right now what I would do is
something like this:
<f:for each="{For.Bar}" as="Bar">
<f:form.textfield name="Bar[]" value="{Bar}"/>
</f:for>
Then inside the controller that saves the Model, I will have a sperated
argument called $Bar and manually assign it's values to the domain model.
With normal strings and even related domain models, flow can
automatically store it's values inside the edited object, as long as you
specify the property name on the form viewhelper.
Even though, the approach i chose works fine, it isn't the most elegant
and flexible way i could imagine. Especially when you dont know, what
kind of object you are editing. Just imagine, you want to create a
viewhelper where you can dynamically add and remove values of an array
type field. something like f:form.arrayfield.
*TL,DR:*
What i essentially need is something like this:
<f:form.arrayfield property="Bar" value="{Foo.Bar}"/>
Is this possible with flow / fluid?
Cheers
--
Christian Loock
Web Developer
Renzel Agentur
www.renzel-agentur.de
More information about the Flow
mailing list