Reputation: 139
I have following form builder:
$builder->add('status', 'choice', array('attr' => array(
'choices' => array('0' => 'Principal', '1' => 'Teacher', '2' => 'Student'),
'required' => true, 'expanded' => 'false', 'multiple' => 'true'
)));
How to present those 3 values as radio buttons in twig template in a way like below presented(it doesn't work)?
{{ form_start(form) }}
{{ form_widget(form.status.choices[0]) }}
{{ form_end(form) }}
Upvotes: 0
Views: 141
Reputation: 1852
If you want radio buttons you need change options to 'expanded' => 'true', 'multiple' => 'false'
In twig:
{{ form_start(form) }}
{{ form_widget(form.status) }}
{{ form_end(form) }}
More information: choice Field Type
Upvotes: 2