zend form custom attribute in select option?

前端 未结 6 1107
慢半拍i
慢半拍i 2020-12-29 09:04

I want know how to add custom attribute for option in a select field of Zend form.

PHP:

$option_values = array(\"multiOptions\" => array(
    \"US         


        
6条回答
  •  北荒
    北荒 (楼主)
    2020-12-29 09:42

    You could extend / overwrite the Zend_View_Helper_FormSelect helper but the real problem is going to be getting the extra data into each option.

    By default, Zend_Form_Element_Select (via Zend_Form_Element_Multi) expects two strings for each option, one for the value attribute and an optional one for the text content. You may need to create your own element to handle the extra data.

提交回复
热议问题