Re: HTML_QuickForm | trouble with checkboxes
| From: | Alexey Borzov | Date: | Tue, 09 Dec 2003 10:49:18 +0000 |
| Subject: | Re: HTML_QuickForm | trouble with checkboxes | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9406@lists.php.net to get a copy of this message | ||
Hi!
Jeff MacDonald wrote:
I'm using HTML_QuickForm v3.2, and I'm attempting to set the 'checked'
attribute on a form with some code like this:
$checkboxes = array();
$c = &HTML_QuickForm::createElement("checkbox", "explicitlyrics", null, "explicit lyrics");
$c->setChecked(false);
$checkboxes[] = $c;
however, when the form is displayed, it is 'checked', despite my call to
setChecked on the object.
This is intended behaviuor: when you add the element to the form, its value gets updated from form's submit, default and constant values.
You should either use setConstants() or set the value or 'checked' attribute *after* adding the element to the form. Be sure to get a reference to the element when doing this.