Quickform issues
| From: | john dot f dot kline at att dot net | Date: | Wed, 15 Jan 2003 19:52:09 +0000 |
| Subject: | Quickform issues | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-3316@lists.php.net to get a copy of this message | ||
Bertrand,
I need to have the following functionality supported in Quickforms 2.1.5:
1) Having a group of radio buttons with no default value set but with a
required rule set. For example, a 'yes' or 'no' question or a mandatory
quality question like: Rate PHP: () superior () average () unacceptable. I
do not want to start with a default value BUT I want to require that a radio
button is selected.
The following code sniblet does not work:
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'Yes',
'Y');
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'No',
'N');
$form->addElementGroup($radio, 'Yes/No:', 'iradYesNo');
$form->addGroupRule('iradYesNo', "question is required.",
'required','',0); //
regardless of '1' or '0')
One thing I do notice is that a warning is thrown on QuickForm.php line 1563
because this radio group is a single value and NOT an array. I can not find
in the code where the decision is made that checkboxes are stored in arrays
and radios as single values? Any hints?
2) An alternative to the above would be having a rule for checkboxes such
that one and only one box is selected. Can this be done? It does not appear
to work.
Thank you.
Jack Kline
PS. I need a solution very soon as I plan on delivering something for a
client asap. THANKS!