Jump to content

Archived

This topic is now archived and is closed to further replies.

ranjuvs

Zend Form - Setting up the form with Multicheckbox

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.