|
|||
|
Hello!
In a project i'm extending the Zend_Form to create a form, in this form in need to use Zend_Form_Element_MultiCheckbox for listing a series of elements coming from a db query, but i also need to set any of this as checked (with the html attributer checked= "checked") how can do this? Here below the code that i use to generate the component PHP Code:
|
|
|||
|
$form = new Zend_Form();
$group = new Zend_Form_Element_MultiCheckbox('groups'); $group->addMultiOption(1,'A'); $group->addMultiOption(2,'B'); $group->addMultiOption(3,'C'); // check item 1 $group->setValue(1); // check items 1 and 3 $group->setValue(array(1,3)); // check all items $group->setValue(true); $form->addElement($group); echo $form->render(); ciao Marcello |
![]() |
| Thread Tools | |
| Display Modes | |
|
|