Re: HTML_QuickForm, advcheckbox, setChecked()

From: Date: Sat, 17 Apr 2004 18:17:45 +0000
Subject: Re: HTML_QuickForm, advcheckbox, setChecked()
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-27871@lists.php.net to get a copy of this message
<pmjones@ciaweb.net> wrote : > 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); 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(). Bertrand Mansion Mamasam

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