QuickForm hierselect element is not working properly for me - 3rd tier not being populated
| From: | l Burnerheimerton | Date: | Thu, 04 Aug 2005 19:07:50 +0000 |
| Subject: | QuickForm hierselect element is not working properly for me - 3rd tier not being populated | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-20278@lists.php.net to get a copy of this message | ||
The code snippet is below of the generated code.
The problem is that the third tier (policy[2]) is not
being populated.
I've checked and the database queries work and you can
even see they are popluating the code before the
javascript.
Any ideas?
html generated code
=======================================
//<![CDATA[
hs_rule_1 = {
"23":".0200 - Section 5",
.....
"33":".1200 Section 13"
}
hs_rule_2 = {
"34":".0200 Section 1",
...
"7":".1501 - Section 14"
}
hs_rule_1_23 = {
"18":"Detail 1",
"19":"Detail 2",
"20":"Detail 3"
}
hs_rule_1_7 = {
"13":"Detail 65"
}
function swapOptions(frm, grpName, eleIndex,
nbElements, arName)
{
var n = "";
var ctl;
for (var i = 0; i < nbElements; i++) {
ctl = frm.form[grpName+'['+i+']'];
if (!ctl) {
ctl = frm.form[grpName+'['+i+'][]'];
}
if (i <= eleIndex) {
n += "_"+ctl.value;
} else {
ctl.length = 0;
}
}
var t = eval("typeof("+arName + n +")");
if (t != 'undefined') {
var the_array = eval(arName+n);
var j = 0;
n = eleIndex + 1;
ctl = frm.form[grpName+'['+ n +']'];
if (!ctl) {
ctl = frm.form[grpName+'['+ n +'][]'];
}
for (var i in the_array) {
opt = new Option(the_array[i], i, false,
false);
ctl.options[j++] = opt;
}
}
if (eleIndex+1 < nbElements) {
swapOptions(frm, grpName, eleIndex+1,
nbElements, arName);
}
}
//]]>
</script><select style="width: 30em;" name="policy[0]"
onchange="swapOptions(this, 'rule', 0, 3,
'hs_rule');">
<option value="1">Choice 1</option>
<option value="2">Choice 2</option>
</select><br /><select style="width: 30em;"
name="policy[1]" onchange="swapOptions(this, 'rule',
1, 3, 'hs_rule');">
<option value="1">.1000 Section 1</option>
...
<option value="33">.1200 Section 13</option>
</select><br /><select style="width: 30em;"
name="policy[2]">
</select>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com