?
Solved

Zend_Form_Element_MultiCheckbox default values? (part of Zend Framework)

Posted on 2010-08-18
1
Medium Priority
?
1,743 Views
Last Modified: 2013-11-10
How to set which checkboxes that are checked by default?

You can use this as a starting point:
http://framework.zend.com/manual/en/zend.form.advanced.html 




0
Comment
Question by:davidsperling
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 2000 total points
ID: 33485455
From http://www.zfforums.com/zend-framework-components-13/model-view-controller-mvc-21/set-element-zend_form_element_multicheckbox-checked-1027.html

and

http://framework.zend.com/apidoc/core/Zend_Form/Element/Zend_Form_Element_MultiCheckbox.html#sec-methods


$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();

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question