HTML_QuickForm, advcheckbox, setChecked()
| From: | Paul M Jones | Date: | Sat, 17 Apr 2004 17:45:42 +0000 |
| Subject: | HTML_QuickForm, advcheckbox, setChecked() | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-27868@lists.php.net to get a copy of this message | ||
Hi --
Would like to know how to pre-check an advanced checkbox. Have searched online PEAR docs ("this element is not documented yet") and the various online tutorials give no joy. My experiment (as follows) does not work; perhaps I am doing something wrong.
I instantiate an advanced checkbox element...
$element =& HTML_QuickForm::createElement(
'advcheckbox',
$elemname, // element name
$col['qf_label'], // label
null,
$col['qf_attrs'], // html attributes
$col['qf_vals'] // array(unchecked, checked)
);
... and then attempt to set it as checked ...
$element->setChecked(true);
... but although a Var_Dump of the element shows "_attributes['checked'] = checked", the rendered HTML does not show it as checked.
Does this have to do with the fact that the advanced-checkbox is not named exactly as requested, but instead prefixed with two underscores, and the field that actually holds the value is a hidden element, with a bit of JavaScript to glue them together? Or am I missing something obvious?
How shall I proceed?
Thanks.
--
Paul M. Jones
pmjones@ciaweb.net
Savant: the simple alternative to Smarty.
http://phpsavant.com/