I have a form that I am trying to add a simple select element to using the following php:
$dateFormat = new Zend_Form_Element_Select('dateFormat');
$dateFormat->setLabel('Date Format:');
$dateFormat->setRequired(true)->addValidator('NotEmpty');
$dateFormat->addMultiOptions(array(
'MM/dd/yyyy' => "US Standard - MM/dd/yyyy",
'dd/MM/yyyy' => "Int'l Standard - dd/MM/yyyy",
'MM-dd-yyyy' => "US Standard Dash - MM/dd/yyyy",
'dd-MM-yyyy' => "Int'l Standard Dash - dd/MM/yyyy",
));
$this->addElement($dateFormat,'dateFormat');
It renders to the page just fine, however it is generating the following XML:
<dt id="dateFormat-label"><label for="dateFormat" class="required">Date Format:</label></dt>
<dd id="dateFormat-element">
<select name="dateFormat" id="dateFormat">
<option value="MM/dd/yyyy" label="US Standard - MM/dd/yyyy">US Standard - MM/dd/yyyy</option>
<option value="dd/MM/yyyy" label="Int'l Standard - dd/MM/yyyy">Int'l Standard - dd/MM/yyyy</option>
<option value="MM-dd-yyyy" label="US Standard Dash - MM/dd/yyyy">US Standard Dash - MM/dd/yyyy</option>
<option value="dd-MM-yyyy" label="Int'l Standard Dash - dd/MM/yyyy">Int'l Standard Dash - dd/MM/yyyy</option>
</select></dd>
Why is it putting a ..label="..."
in the <option>
tag? Is this actually how it is supposed to be done for XHTML standards? I have my doctype set to XHTML Strict.