I'm having trouble using Form builder in Symfony2. More precisely, I need an input field, which is an html array, but I cannot create it using createFormBuilder-> add. Here is what I tried:
$attributesForm = $this->createFormBuilder() ->add('attribute[0]', 'text') ...
And so on, but I get the following exception:
The name "attribute [0]" contains invalid characters. Names must begin with a letter,> numbers or underscores and contain only letters, numbers, numbers, underscores ("_"), hyphens> ("-"), and colons (":").
Is there any good solution or do I need to create fields manually?
Thanks in advance!
EDIT: clarify this further ... I want to create something like this:
<div id="msoft_adminbundle_offertype"> <div>Name <input type="text" name="name"></div> <div>...</div> <div>Attribute 0 <input type="text" name="attribute[0]"></div> <div>Attribute 1 <input type="text" name="attribute[1]"></div> <div>Attribute 3 <input type="text" name="attribute[3]"></div> <ul> </ul> <p> <button type="submit">Edit</button> </p>
reference
source share