PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #2709

Solo group of radio elements missing error

Details

Submitted2004-11-07 10:49 UTC
Fromm at dreamer dot tv
Assignedavb
StatusClosed
PackageHTML_QuickForm
PHP Version4.3.8
OSWin2k, Linux
Roadmaps(Not assigned)

Comments

[2004-11-07 10:49 UTC] m at dreamer dot tv

Description:
------------
Quickform PEAR Ver: 3.2.2 - 3.2.4pl1

Problem: Rules (addRule nor addGroupRule) for a group of radio elements does not validate (although an object dump reveals that rule has been registered) when there are no other form elements added. This issue disappears when group of radios are not the only element in the form.

Reproduce code:
---------------
URL: http://dreamer.tv/bugs/
http://dreamer.tv/bugs/radioErrBug1.php - reproduces bug
http://dreamer.tv/bugs/radioErrBug2.php - conceals bug

Script: section extracted from Quickform example...
---
// Creates a standard radio buttons group
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'Yes', 'Y');
$radio[] = &HTML_QuickForm::createElement('radio', null, null, 'No', 'N');
$form->addGroup($radio, 'iradYesNo', 'Yes/No:');

// Validate the radio buttons
$form->addRule('iradYesNo', 'Check Yes or No', 'required');
// This can also be done using:
// $form->addGroupRule('iradYesNo', 'Radio is required', 'required', null, 1);
---

Expected result:
----------------
The script has set a 'required' type rule to the group of radio elements; without any radio selected, a submission is suppose to prompt an error message.

Actual result:
--------------
There is no error message reported.