如何从MultiCheckbox中禁用/只读一些复选框?

时间:2021-08-18 20:34:03

I have a Zend_Form_Element_Multicheckbox and I want to put some of its elements in a readonly state, how do I do that?

我有一个Zend_Form_Element_Multicheckbox,我想把它的一些元素放在readonly状态,我该怎么做?

    $colId = new Zend_Form_Element_MultiCheckbox('colId');
    $colId->setLabel('Col ID')
        ->setMultiOptions(array_flip(array('sadda', 'asss'));

2 个解决方案

#1


I think the following should work:

我认为以下应该有效:

$colId
    ->setMultiOptions(array_flip(array('sadda', 'asss'))) // three closing-brackets 
    ->setAttrib('disable', array('sadda', 'asss'));

#2


It works; be sure to use "disable" and not "disabled" in your setAttrib.

有用;请务必在setAttrib中使用“禁用”而不是“禁用”。

#1


I think the following should work:

我认为以下应该有效:

$colId
    ->setMultiOptions(array_flip(array('sadda', 'asss'))) // three closing-brackets 
    ->setAttrib('disable', array('sadda', 'asss'));

#2


It works; be sure to use "disable" and not "disabled" in your setAttrib.

有用;请务必在setAttrib中使用“禁用”而不是“禁用”。