ranjuvs 0 Posted September 9, 2008 Share Posted September 9, 2008 Any one who is familiar with Zend framework please help me I need to set up a form using Zend form. And I need to implement check box with multiple options. $area = $form->createElement('multiCheckbox', 'area_type'); $area->setLabel('Type of Area:'); $area->addMultiOption('1', 'Shopping district (individual shops on a street)'); $area->addMultiOption('2', 'Shopping mall'); $area->addMultiOption('3', 'Mini-mall'); $area->addMultiOption('4', 'Airport shop'); $area->addMultiOption('5', 'Other'); I need to make couple of checkboxes checked while the form is loaded. How can I do that. If I set the value of area_type in database as any of the values, then it shows as checked. I want multiple items to be checked Thanks in advance Link to post Share on other sites
mipetala 0 Posted April 8, 2011 Share Posted April 8, 2011 Dear Ranjuvs, I have the same problem. Have you found a solution? If so, would it be possible to share with us? Thanks in advance. Link to post Share on other sites
Maq 29 Posted April 8, 2011 Share Posted April 8, 2011 Hi mipetala, I'm sure you found this thread through a search but it's from Sept. 2008. It would be better if you started a new thread with your specific problem. Link to post Share on other sites
johnny86 0 Posted April 8, 2011 Share Posted April 8, 2011 Example: $area = $form->createElement('multiCheckbox', 'area_type'); $area->setLabel('Type of Area:'); $area->addMultiOption('1', 'Shopping district (individual shops on a street)'); $area->addMultiOption('2', 'Shopping mall'); $area->addMultiOption('3', 'Mini-mall'); $area->addMultiOption('4', 'Airport shop'); $area->addMultiOption('5', 'Other'); $area->setValue(array('2', '5')); // Selects area 2 and 5 Link to post Share on other sites
mipetala 0 Posted April 11, 2011 Share Posted April 11, 2011 Unfortunately this doesn't work for me: $area->setValue(array('2', '5')); Link to post Share on other sites
Recommended Posts
Archived
This topic is now archived and is closed to further replies.