PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_QuickForm » Bug #5928

Rule not applied when element name is a integer

Details

Submitted2005-11-10 18:45 UTC
Frommartin dot ottenwaelter at free dot fr
StatusWont fix
PackageHTML_QuickForm
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-11-10 18:45 UTC] martin dot ottenwaelter at free dot fr

Description:
------------
When a form element's name is an integer, even though it is
given as a string in the addElement function, rules are not
applied to the element. Therefore, the form validates even if
some rules would have normally prevented it.

html_quickform version : 3.2.5
php version : bug tested with versions 4 and 5

Test script:
---------------
require_once 'HTML/QuickForm.php';

$form = new HTML_QuickForm();
$form->addElement('text','1','Label');
$form->addRule('1','Label is required !','required');

if ($form->validate()) {
echo "Form submitted";
} else {
echo $form->toHtml();
}

Expected result:
----------------
If the form's text input is left blank, the string "Label is
required !" should appear, showing that the form did not
validate.

Actual result:
--------------
When the form's text input is left blank, the string "Form
submitted" appears, showing that the form did validate, which
should not because of the rule we added.