Symfony2 Forms - custom input names
I use Symfony2 form generation in a common way.
$form = $this->createForm(new ValueType(), $entity);
$view = $form->createView();
This renders form like
<input name="test_commonbundle_valuetype[value]" ...
How to make it to generate custom names开发者_如何学JAVA - like
<input name="test_commonbundle_sometype[values][N][value]"
?
I need it as i manually render entity template for parent object w/ajax processing - so getting child object and form.values does not suit for me.
In your form type you can add the property_path => false option to add a field to the form without being used by the entity.
$builder->add('myFancyName','text',array('property_path' => false);
精彩评论