Re: HTML_QuickForm, advcheckbox, setChecked()

From: Date: Sat, 17 Apr 2004 19:14:09 +0000
Subject: Re: HTML_QuickForm, advcheckbox, setChecked()
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-27877@lists.php.net to get a copy of this message
On Apr 17, 2004, at 1:17 PM, Bertrand Mansion wrote:
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);
This would work with a normal checkbox but not with the advanced checkbox. You should use $element->setValue() instead or set the default value with $form->setDefaults().
$form->setDefaults() is probably not going to do it for me; I'm building it element-by-element. So it would have to be $element->setValue(1)... ... and that doesn't do it either. _attributes['value'] is 1, and ['checked'] is 'checked'. The hidden field is named "edit[comments]" and the javascripted checkbox is named "__edit[comments]", but it's not set as checked. Hm. Sorry to be dumb. :-( What could I be doing wrong here? -- Paul M. Jones pmjones@ciaweb.net Savant: the simple alternative to Smarty. http://phpsavant.com/

« previous php.pear.dev (#27877) next »