| Alexey Borzov 2007-05-22, 7:02 pm |
| Hi,
Eugen Stoianovici wrote:
> 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
Looks like it is already reported as a bug:
http://pear.php.net/bugs/bug.php?id=11047
The workaround, as was already mentioned, is to use setDefaults() rather than
setChecked(), but I think this behaviour still needs to be fixed. Expect
QuickForm 3.2.8 Really Soon Now as I'm currently doing releases for all the
packages I maintain.
> 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?
>
|