Re: QF required radio group
| From: | Michael Wallner | Date: | Fri, 22 Oct 2004 12:48:13 +0000 |
| Subject: | Re: QF required radio group | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15041@lists.php.net to get a copy of this message | ||
I wrote:
> Hmmm, seems that I'm suffering from the same problem
> like yesterday, the only difference being that I'm
> not really able to make a "radio group" required.
>
> As soon as I add a "required" rule to a group of
> radios, QF doens't validate to true, although I've
> checked a radio...
I figured that this only happens if the group name
contains square brackets, should I open a bug for
that, Alexey?
Example:
--- cut ---
require_once 'HTML/QuickForm.php';
$form = &new HTML_QuickForm('foo');
$r[] = &$form->createElement('radio', null, null, 'yes',
'yes');
$r[] = &$form->createElement('radio', null, null, 'no', 'no');
$form->addGroup($r, 'yesorno[mine]', 'Choose:');
$form->addGroupRule('yesorno[mine]', 'Choose one!', 'required');
$form->addElement('submit', null, 'Submit');
if ($form->validate()) echo "<h1>YEAH!</h1>\n";
$form->display();
--- cut ---
Regards,
--
Michael - < mike(@)php.net >
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc