我使用这种方式创建了一个multiheckbox元素:
$furniture = new Zend_Form_Element_MultiCheckbox('furnishing');
$furniture->setLabel('furniture')
->setMultiOptions(array(
'computer_table' => 'Table for computer',
'coffee_table' => 'Cofee table',
))
->setDecorators($formMultipleDecorators)
->setOptions(array('class' => 'form-checkbox'))
->setSeparator('');
此代码添加以形成下一个HTML代码:
<label>
<input type="checkbox" name="furnishing[]" id="furnishing-computer_table" value="computer-table" class="form-checkbox">Table for computer
</label>
<label>
<input type="checkbox" name="furnishing[]" id="furnishing-coffee_table" value="coffee-table" class="form-checkbox">Cofee table
</label>
是否可以将输入ID设置为“furnishing_computer_table”而不是“furnishing-computer_table”?
答案 0 :(得分:0)
变化:
->setOptions(array('class' => 'form-checkbox'))
要:
->setOptions(array('class' => 'form-checkbox','id'=>'furnishing_computer_table'))