简体   繁体   中英

How to set separator for Zend_Form_Element_MultiCheckbox id attribute?

I have created a multicheckbox element using this way:

$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('');

This code add to form next html code:

<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>

Is it possible to set input id to "furnishing_computer_table" instead of "furnishing-computer_table"?

Change:

 ->setOptions(array('class' => 'form-checkbox'))

To:

 ->setOptions(array('class' => 'form-checkbox','id'=>'furnishing_computer_table'))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM