I am trying to add some CSS classes to specific options of my select.
It is no problem to add it to the select itself with the attr:
'attr'=>array('style'=>'width:300px', 'class'=>'class'),
But I want to add the class to the options itself:
<select name="select">
<option class="x" value="1">red</option>
<option value="2">blue</option>
<option class="y" value="3">green</option>
</select>
I haven't found any way, yet. I investigated already the ChoiceType and the ChoiceList implementations.
My favorite way would be to add them on server side.
Thanks for any hints.