How to setup a Zend_Form_Element_Select with multiple params at OPTION tags
I am creating a Zend Form to allow the user to change the current Locale from a list saved in my DB. I would like to know how to add more attribs to the option list.
$obj_locales_select = new Zend_Form_Element_Select('sel_locale');
$obj_locales_select->setLabel('form-params-language-changelocale-sel_locale-label');
$obj_locales_select->setMultiOptions($this->_arr_locales);
$obj_locales_select->setValue($this->_str_selected_locale);
$obj_locales_select->setRequired(true);
$obj_locales_select->setAttrib('tabindex', '100');
The $this->_arr_locales is just an associative array 开发者_StackOverflowwith key - values. But I want, in example, to add a title attrib to each option generated, so when the user's mouse is over an option, the browser displays a tip with additional info about that option, or some other standard attribs (according to the w3schools OPTION tag).
Thanks for help.
ZF does not support title attribute for Zend_Form_Element_Select options. You should write custom view helper to do that.
精彩评论