ZF-6170: [trunk] Zend_View_Helper_FormSelect additional attributs per option


There is no option to give an single element an html attribute, i.e. class for layouting.

In my situation i tried to create an select with default option, and i would like to add some html attributes to it, i.e. class.


formSelect()'s third argument, $attribs, let's you do precisely this:

echo $this->formSelect('foo', '', array('class' => 'foobar'), $options);

which will set the 'class' attribute of the select to 'foobar'.

You cannot set the class for individual options within the select, but that's an edge case we really cannot support.