View Single Post
  #1 (permalink)  
Old 05-08-2008, 10:13 AM
luka.bernardi luka.bernardi is offline
Junior Member
 
Join Date: May 2008
Posts: 1
Default Set a element of Zend_Form_Element_MultiCheckbox as "checked"

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:
$group = new Zend_Form_Element_MultiCheckbox('groups');
        
$group->setLabel('Groups');
        
$groups = new Groups();
        
$groupsRows $groups->fetchAll();
        foreach (
$groupsRows as $groupsRow ){
            
            
$group->addMultiOption($groupsRow->id,$groupsRow->name);
        } 
Reply With Quote