In Symfony2, the select
html component is rendered as a ChoiceType
object, which is used indeed also for checkboxes
and radiobuttons
.
Does someone really know how to render a select with the optgroup option in Symfony2?
For sake of completeness, here I report an example of a select with the optgroup tag (example from w3cschools):
<select>
<optgroup label="Swedish Cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
</select>
Moreover, notice that there is a similar post here, but the answers are not convincing.