1

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 - 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.

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

1 Comment

Doesn't work with [, ] symbols: The name "ticket[filters][0]" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.