Problem with quickform checkbox
| From: | Eugen Stoianovici | Date: | Tue, 22 May 2007 13:25:08 +0000 |
| Subject: | Problem with quickform checkbox | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-27347@lists.php.net to get a copy of this message | ||
I have a form with a few checkboxes used for updating some entrys. The problem is that if i use checkbox::setChecked(true), the checkbox remains checked even if the user unchecks it
here's the code:
$form = new HTML_QuickForm('events','POST',$_SERVER[REQUEST_URI],NULL,true);
$form->addElement('text', 'ca', 'CA:');
$rmodem =& $form->addElement('checkbox', 'rmodem', 'Reset modem:');
$rsoft =& $form->addElement('checkbox', 'rsoft', 'Reset soft:');
$rhard =& $form->addElement('checkbox', 'rhard', 'Reset hard:');
$form->addElement('text', 'phone, 'phone:');
if($def["rhard"]>0)
$rhard->setChecked(true);
if($def["rmodem"]>0)
$rmodem->setChecked(true);
if($def["rsoft"]>0)
$rsoft->setChecked(true);
if($form->validate()){
$form->freeze();
savedata($form);
}
echo $form->toHtml();
If rhard is checked in the inital display and the user unchecks it, form->freeze still sees it checked
what am i doing wrong?