[FLOW3-general] Form builder, cloning forms

mario chiari m at mariochiari.net
Thu Jan 24 22:57:25 CET 2013


Hi Bastian, 

thanks for your reply, and for the test.
I'll try too and let you know.
cheers
mario

On Thu, 2013-01-24 at 20:48 +0100, Bastian Waidelich wrote:
> mario chiari wrote:
> 
> Hi Mario,
> 
> > I have just realized the power of flow's form builder. It seems very
> > nice.
> 
> Thank you and sorry for the late reaction, I wanted to test this first:
> 
> > Still, before to look at it carefully I wish to know how easy/difficult
> > could be to use it with a simple JQuery plugin to let a user to clone a
> > form, say with  http://jdmweb.com/form-cloning-jquery-plugin .
> 
> Good question!
> That won't work "out of the box" indeed, because the form will only 
> process values that you have defined in your form factory.
> 
> But if you use the "dot syntax" as element identifier, they are rendered 
> as arrays:
> 
> $name = $addressFieldset->createElement('address.0.name', 
> 'TYPO3.Form:SingleLineText');
> 
> renders as:
> 
> formName[address][0][name]
> 
> if you clone that to
> formName[address][1][name], formName[address][2][name], ...
> 
> You'll get
> array(
>    'address' => array(
>      0 => array(
>        'name' => 'Name1'
>      ),
>      1 => array(
>        'name' => 'Name2'
>      ),
>      2 => array(
>        'name' => 'Name3'
>      ),
> ...
> 
> 
> So yes this works and I'll add that example to the FormExample package 
> [1] if I find the time.
> 
> 
> HTH,
> 
> 
> [1] http://git.typo3.org/FLOW3/Packages/TYPO3.FormExample.git
> 
> 




More information about the Flow mailing list