Home » HTML » HTML_QuickForm » Bug #4131
Javascript group validation fails when group name is a number
Details
| Submitted | 2005-04-12 21:03 UTC |
|---|---|
| From | pete at phunkymunky dot net |
| Status | Wont fix |
| Package | HTML_QuickForm |
| PHP Version | 4.3.10 |
| OS | FC3 |
| Roadmaps | (Not assigned) |
Comments
[2005-04-12 21:03 UTC] pete at phunkymunky dot net
Description:
------------
PEAR 1.3.5
QuickForm 3.2.4pl1
When creating a group rule for an element, if the group name is a number, the client side validation will fail. This is because the javascript variable name generated by RuleRegistry.php begins with a number also which is invalid for a javascript variable name.
To fix this, I replaced all instances of "{$elementName}Elements" with "q_{$elementName}Elements" in RuleRegistry.php. This has no effects on the function of the code, but squashes this bug immediately.
Actual result:
--------------
When using an unmodified RuleRegistry.php, the following javascript error is seen in the Javascript Console:
Error: missing variable name
Source File: http://<<site>>/participate.php?survey_id=5
Line: 69, Column: 6
Source Code:
var 1Elements = '::1[question_1]::1[question_1]::';
--^