Re: HTML_Quickform and setDefaults for radio group

From: Date: Mon, 21 Jun 2004 15:04:41 +0000
Subject: Re: HTML_Quickform and setDefaults for radio group
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13231@lists.php.net to get a copy of this message
Tizzle wrote: >I am trying to set the default value for a group of radio buttons as >follows, with no luck: > >$radios[] = &HTML_QuickForm::createElement('radio', 'sex', null, >'man', 'm'); >$radios[] = &HTML_QuickForm::createElement('radio', 'sex', null, >'vrouw', 'f'); > >$uploadForm->setDefaults(array('sex','m')); > >$uploadForm->addGroup($radios, null, 'Geslacht:', ' '); > >as far as i can see this is exactly according to the manual but no >default is set... The way you add the radios is not correct. $radio[0] =& HTML_QuickForm::createElement('radio', null, null, 'man', 'm'); $radio[1] =& HTML_QuickForm::createElement('radio', null, null, 'vrouw', 'f'); $radio[2] =& HTML_QuickForm::createElement('radio', null, null, 'other', 'o'); $uploadForm->addGroup($radio, 'sex', 'Geslacht:', ' '); $uploadForm->setDefaults(array('sex' => 'o')); Bertrand Mansion Mamasam PS: Feel free to remove the third option if you don't need it :D

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