Basically, I need an extra bit of data to be included in a select box which is created with Zend. The current markup is as follows:
<select>
<option label="Canadian Dollar ($)" value="1">Canadian Dollar ($)</option>
<option label="Euro (€)" value="2">Euro (€)</option>
<option label="US Dollar ($)" value="3">US Dollar ($)</option>
</select>
The markup I'm trying to achieve is as follows (notice the additional 'data-curreny-type' attribute):
<select>
<option label="Canadian Dollar ($)" value="1" data-currency-code="CAD">Canadian Dollar ($)</option>
<option label="Euro (€)" value="2" data-currency-code="EUR">Euro (€)</option>
<option label="US Dollar ($)" value="3" data-currency-code="USD">US Dollar ($)</option>
</select>
The form is being created using Zend as follows:
$element = new Zend_Form_Element_Select(self::NAME);
/* -- OMMITED DB CODE --*/
$element->setOptions($options);
$options is an array in the form of: array('1' => 'Value1', '2'=> 'Value2').. etc.
My qestion is, is there any way of adding extra elements into the 'options' element using Zend ->setOptions($opts)? Or anything I might not be aware of.
Please help!