symfony2 customize form select options
问题 I'm trying to do a simple form to add an activity with a name and a color. So I want to make a list with some an array of color, for now it is working I have the name of the color. I can add any attribute to my select tag: $form = $this->createFormBuilder($myclass) ->add('Colors','choice',array('label'=>'select some colors', 'multiple'=>true, 'choices'=>array(1=>'red', 2=>'blue', 3=>'green'), 'attr'=>array('style'=>'width:300px', 'customattr'=>'customdata') )); The output will be something