I am using this code to create symfony2 form:
$builder
->add('layout_type', 'choice', array(
'choices' => array(0 => 'Small layout', 1 => 'Big layout'),
'expanded' => true,
'disabled' => $disabled
))
.... ))
The problem I have is with radio buttons validation (layout_type, choice).
When I don't select any of radio buttons and submit form, data are not inserted in database. It is correct because radio buttons are obligatory field, but when form is reloaded I don't have message about error for radio buttons. I am getting errors for all other fields correctly.
Twig I am using:
<table width="1000">
<tr>
<td class="label">{{ form_label(form.layout_type, 'LAYOUT_TYPE') }}</td>
<td class="widget">{{ form_widget(form.layout_type) }} {{ form_errors(form.layout_type) }}</td>
</tr>
...
And for validation I am using annotation:
/**
* @var Integer
* @Assert\NotBlank(message="NOT_EMPTY")
*/
protected $layoutType;
I have problem only with error message for $layoutType radio buttons Does someone know what can be a problem. Thx