Home » HTML » HTML_QuickForm » Bug #8497
3.2.6 hierselect can't handle numeric options (chokes on indexOf)
Details
| Submitted | 2006-08-18 05:01 UTC |
|---|---|
| From | gmalazdrewicz at gmail dot com |
| Assigned | avb |
| Status | Closed |
| Package | HTML_QuickForm |
| PHP Version | 4.3.9 |
| OS | Linux 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);
}
-------------------------------------------------------------