Symfony Form Type with multiple input fields

custom-field-type, forms, symfony-2.1

Solution

You will need to create a custom field type. The best way to achieve it is to look at the code of the DateTimeType.

Remember to create as well the appropriate Twig form template.

Problem

With Symfony 2.1, how can I create a form type with multiple input fields in it? So in the form builder I want to add a custom form type : ``` $builder->add('test','my_fieldtype') ``` Then if I do this in the template : ``` {{ form_row(form.test) }} ``` I want it to display a row that has a label and 2 or 3 input fields. Something like the date type I suppose.

Original source