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

3.2.6 hierselect can't handle numeric options (chokes on indexOf)

Details

Submitted2006-08-18 05:01 UTC
Fromgmalazdrewicz at gmail dot com
Assignedavb
StatusClosed
PackageHTML_QuickForm
PHP Version4.3.9
OSLinux 2.4.21 (RHEL3)
Roadmaps(Not assigned)

Comments

[2006-08-18 05:01 UTC] gmalazdrewicz at gmail dot com

Description:
------------
Use of hierselect with numeric options causes it to cease functioning when you choose another option.

Firefox JavaScript console reports "indexOf is not a function"

Fix: Convert the numeric options to strings before processing.

Test script:
---------------
Patch:
-------------------------------------------------------------
for (i in optionList) {
+ var option = String(optionList[i]);
- var optionText = (-1 == optionList[i].indexOf('&'))? optionList[i]: _hs_unescapeEntities(optionList[i]);
+ var optionText = (-1 == option.indexOf('&'))? option: _hs_unescapeEntities(option);
ctl.options[j++] = new Option(optionText, i, false, false);
}
-------------------------------------------------------------