I'm pretty confused about this element ...

My form code:

$career = new Zend_Form_Element_MultiCheckbox('career_name');
$career->setLabel('Careers');
$career->setMultiOptions($careers)
->setDecorators(array(
'ViewHelper',
'Errors',
array(array('elementTable' => 'HtmlTag'), array('tag' => 'table')),
array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div', 'class' => 
'overflowDiv')),
array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
array('Label', array('tag' => 'td')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
));
$this->addElement($career);

$careers is an assoc array with key = id and value = name
This creates html that I would think would work ... e.g.

< ... >


<label for="career_name-1"><input type="checkbox" name="career_name[]" 
id="career_name-1" value="1" />Brewmaster</label><br /> <label 
for="career_name-3"><input type="checkbox" name="career_name[]" 
id="career_name-3" value="3" />Lunch Server</label><br />

< ... >


 However, when I check any number of boxes, the key 'career_name' shows up in 
the $_POST but it is an empty array.  If no boxes are checked, the key does not 
show up in $_POST (expected).  $form->getValues() has nothing related to 
'career_name' whether or not anything is checked.

If I create a simple test case using the html above, $_POST returns an array of 
vals for career_name for each box checked and nothing if nothing is checked as 
expected.   It certainly seems as if ZF is stripping the values out of the 
$_POST??

Any thoughts?

Reply via email to