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 #3035

JS validation bug

Details

Submitted2004-12-27 14:10 UTC
Fromilia at manual dot ru
Assignedavb
StatusClosed
PackageHTML_QuickForm
PHP Version5.0.3
OSFreeBSD 5.3
Roadmaps(Not assigned)

Comments

[2004-12-27 14:10 UTC] ilia at manual dot ru

Description:
------------
selects with size>1 have no chosen element so JS validation code fails with error.

Solution:

RuleRegistry.php about line 280

$value = " value{$jsIndex} = frm.elements['{$elementName}'].options[frm.elements['{$elementName}'].selectedIndex].value;\n";

change to

$value = " value{$jsIndex} = frm.elements['{$elementName}'].selectedIndex != -1 ? frm.elements['{$elementName}'].options[frm.elements['{$elementName}'].selectedIndex].value : '';\n";

[2005-03-14 13:06 UTC] bigtree-dontspamme at 29a dot nl

Actually, the bug appears if a 'select' element with 'multiple' set to false does not have any option elements. In that case, selectedIndex is -1.

The fix ilia at manual dot ru suggested works for me.