[Flow] Form ViewHelper for property that is an array of strings

Christian Loock chl at vkf-renzel.de
Fri Jul 25 08:42:40 CEST 2014


Hi again,

another little problem I encountered.

When I have a widget ViewHelper inside a f:form, form fields inside this 
viewHelper, won't have the correct fieldNames, since they dont seem to 
be aware of the form object of the form that is surrounding the widget. 
I assume this has to do with the fact, that a widget is renderen in it's 
own subrequest, which probably isn't aware of the fact, that there is a 
form surrounding the widget. Is there a way to make form elements inside 
the widget aware of a surrounding form?

Cheers,

Christian


On 24.07.2014 16:32, Christian Loock wrote:
> Hi Bastian,
>
> you might be right that from case to case it might be better not to 
> use arrays, but in my case I feel like creating a new Model to just 
> store simple strings, would be a bit to much.
>
> Thank you for your example, I will try it out. Will this also work 
> with numerical indices?
>
>
> On 24.07.2014 16:26, Bastian Waidelich wrote:
>> Christian Loock wrote:
>>
>> Hi Christian,
>>
>>> I wonder if there is some sort of best practice for form fields, that
>>> shall represent arrays of scalar types.
>>
>> The best practice would be not to use arrays.. *duck*
>> SCNR, and sometimes arrays do make a lot of sense of course.
>>
>>
>>> What i essentially need is something like this:
>>>
>>> <f:form.arrayfield property="Bar" value="{Foo.Bar}"/>
>>>
>>> Is this possible with flow / fluid?
>>
>>
>> Not out of the box, but of course you could create a 
>> Form\ArrayfieldViewHelper.
>> But probably you won't even need that - If I got you right, this is 
>> what you need:
>>
>> https://gist.github.com/bwaidelich/ae5a8245161f3f1cee5e
>>
>> But be aware: By tweaking the POST data one can add arbitrary keys to 
>> the array so you should sanitize it on the server-side.
>>
>

-- 
Christian Loock
Web Developer
Renzel Agentur
www.renzel-agentur.de



More information about the Flow mailing list