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

Bastian Waidelich bastian at typo3.org
Thu Jul 24 16:26:10 CEST 2014


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.

-- 
Bastian Waidelich


More information about the Flow mailing list