Re: quickform : setChecked doesn't work

From: Date: Sat, 30 Dec 2006 09:20:29 +0000
Subject: Re: quickform : setChecked doesn't work
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26231@lists.php.net to get a copy of this message
Justin Patrin <papercrane@gmail.com> a écrit :
On 12/26/06, pear@elfloridita.net <pear@elfloridita.net> wrote:
Hi I have a quickform form with two radio input. I want the first one to be checked when the page is loaded. I tried : $radios[] = &HTML_QuickForm::createElement('radio', null, null, 'label1', 'val1', array('class' => 'radio'); $radios[] = &HTML_QuickForm::createElement('radio', null, null, 'label2', 'val2', array('class' => 'radio'); $radios[0]->setChecked(true); $form->addGroup($radios, 'grp', 'Label'); but that doesn't work, nothing's checked. I also tried : $radios[] = &HTML_QuickForm::createElement('radio', null, null, 'label1', 'val1', array('class' => 'radio', 'checked' => 'checked'); $radios[] = &HTML_QuickForm::createElement('radio', null, null, 'label2', 'val2', array('class' => 'radio'); $radios[0]->setChecked(true); $form->addGroup($radios, 'grp', 'Label'); but the checked parameter is ignored (doesn't appear in HTML source) Can someone help me ?
Try using $form->setDefaults(). --Justin Patrin --PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
That works, thank you Julien

« previous php.pear.general (#26231) next »