我有一个表单,我正在尝试添加一个简单的选择元素以使用以下 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');
它可以很好地呈现到页面,但是它正在生成以下 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>
为什么要..label="..."
在<option>
标签中添加a?这实际上是 XHTML 标准应该如何做的吗?我的 doctype 设置为 XHTML Strict。