I need to collect array of data via input fields. For example:
<input name="customer_name" type="text">
<input name="customer_emails[]" type="text">
<input name="customer_emails[]" type="text">
<input name="customer_emails[]" type="text">
How to render this type of form in Symfony2 form builder?
Documentation says:
$builder->add('emails', 'collection', array(
// each item in the array will be an "email" field
'type' => 'email',
// these options are passed to each "email" type
'options' => array(
'required' => false,
'attr' => array('class' => 'email-box')
),
));
It is not clear to me where I should provide the number of email fields I want.