LuRsT
LuRsT

Reputation: 4103

How to disable/readonly some checkboxes from a MultiCheckbox?

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?

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

Upvotes: 3

Views: 2124

Answers (2)

Jeff Girard
Jeff Girard

Reputation: 79

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

Upvotes: 1

Kieran Hall
Kieran Hall

Reputation: 2627

I think the following should work:

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

Upvotes: 6

Related Questions