Re: QuickForm: setting checkbox when editing
| From: | Justin Patrin | Date: | Fri, 20 May 2005 17:12:19 +0000 |
| Subject: | Re: QuickForm: setting checkbox when editing | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19313@lists.php.net to get a copy of this message | ||
On 5/20/05, Stowe, Nola <NStowe@thettgroup.com> wrote:
> Sorry for the double post, my bad, learning to use the newsgroup software..
>
> I used the advcheckbox and that worked fine. Don't know what the problem was
> with checkbox.
>
> Could you give me an example of using the setChecked method please?
$el =& $form->addElement('checkbox', 'name');
$el->setChecked(true);
>
> Thanks Justin!
>
> -----Original Message-----
> From: Justin Patrin [mailto:papercrane@gmail.com]
> Sent: Thursday, May 19, 2005 11:05 PM
> To: Nola
> Cc: pear-general@lists.php.net
> Subject: Re: [PEAR] QuickForm: setting checkbox when editing
>
> On 5/18/05, Nola <nola@devasap.com> wrote:
> > I tried to search before sending this, so I'm sorry if I could not
> > find where this has been said before.
> >
> > I am using the form to edit, so I use the form->setDefaults($array) to
> > set the form fields with the data to edit, but I don't know how to set
> > the checkboxes.
> >
> > Do I need to check the value of my variable and if == 1, then set the
> > attribute "checked" for the checkbox?
> >
>
> setDefaults should work fine. If it doesn't, try using setChecked on the
> checkbox.
>
--
Justin Patrin