I have been having the same problem as detailed above.
In my template i am displaying my form elements like this - without any
decoration cos the decorators have caused me endless amounts of trouble.
<dd><?=$this->formCheckbox($this->form->other_venue->getName(),
$this->form->other_venue->getValue(),
$this->form->other_venue->getAttribs()); ?></dd>
but i found that passing the value here is stopping the checkbox value from
being passed back when the form is submitted. When i instead used:
<dd><?=$this->formCheckbox($this->form->other_venue->getName());
The value was being passed back but the checkbox was still not getting
prepopulated. I know its ugly but i ended up having to check if the checkbox
is set and if so then pass the value otherwise dont!!
<dd>
<?
if ($this->form->other_venue->isChecked()) {
echo
$this->formCheckbox($this->form->other_venue->getName(),
$this->form->other_venue->getValue(),
$this->form->other_venue->getAttribs());
}
else {
echo
$this->formCheckbox($this->form->other_venue->getName());
}
?>
This utterly reeks of a hack but i have searched high and low for a solution
to my problem and found nothing. Ultimately i need a solution whether its
elegant or not. hope it helps someone else.
Note that the approach i am using above for outputting without decorators
comes from:
http://monzee.wordpress.com/2009/02/23/decorators-are-hard-lets-go-shopping/
--
View this message in context:
http://www.nabble.com/Zend_Form_Element_Checkbox-not-populating-state--tp22378451p23544840.html
Sent from the Zend Framework mailing list archive at Nabble.com.