Re: QuickForm + ITDynamic renderer: problem with required radio button
| From: | Cesare D'Amico | Date: | Fri, 07 Mar 2008 15:16:44 +0000 |
| Subject: | Re: QuickForm + ITDynamic renderer: problem with required radio button | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-28614@lists.php.net to get a copy of this message | ||
Il giorno venerdì 07 marzo 2008, Hollenbeck, Dan ha scritto:
> Hi Cesare,
>
> I don't use the radio element, but rather use the altselect which
> produces radio buttons. Try something like this:
>
> $radio_options = array('0'=>'I like QuickForm',
> '1'=>'I love
> QuickForm'); $element =& $form->addElement('altselect',
> 'field_name',
> 'Label Options', $radio_options); $element->setDelimiter('');
> $form->addRule('field_name', 'Please select an option',
> 'required',
> null, 'client');
I didn't know about the altselect element, thanks a lot for the hint!
> This would would work fine with your HTML template and you will only
> get one one error when the user does not select a radio option.
Great.
> Also, you should consider changing your QuickForm renender so that
> the required note is added automatically to your quickform label so
> you don't need to add it via your HTML template.
Which renderer would you recommend?
> Thanks, Dan
Thanks to you ;)
Ciao
Cesare
--
Cesare D'Amico | Gruppo Volta
Area tecnica | Web & Mkt Solutions
Tel: 045 21 000 84 | Via Leida 8 - Verona
Fax: 045 21 000 85 | http://www.gruppovolta.it