[FLOW3-general] Form builder, cloning forms
Bastian Waidelich
bastian at typo3.org
Thu Jan 24 20:48:29 CET 2013
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
--
Bastian Waidelich
--
Core Developer Team
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the Flow
mailing list