ranjuvs 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 comment https://forums.phpfreaks.com/topic/123401-zend-form-setting-up-the-form-with-multicheckbox/ Share on other sites More sharing options...
mipetala 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 comment https://forums.phpfreaks.com/topic/123401-zend-form-setting-up-the-form-with-multicheckbox/#findComment-1198751 Share on other sites More sharing options...
Maq 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 comment https://forums.phpfreaks.com/topic/123401-zend-form-setting-up-the-form-with-multicheckbox/#findComment-1198764 Share on other sites More sharing options...
johnny86 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 comment https://forums.phpfreaks.com/topic/123401-zend-form-setting-up-the-form-with-multicheckbox/#findComment-1199004 Share on other sites More sharing options...
mipetala Posted April 11, 2011 Share Posted April 11, 2011 Unfortunately this doesn't work for me: $area->setValue(array('2', '5')); Link to comment https://forums.phpfreaks.com/topic/123401-zend-form-setting-up-the-form-with-multicheckbox/#findComment-1199938 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.