Hello:
I am having a problem with to linked comboxes in IE7. Here is my problem that is ONLY ocurring in IE7: I have javascripts functions to populate the second of 2 comboxes given the selected option on the first one; the scripts look to be ok since they work perfectly on firefox 3.08 and also on IE6 and IE8; I have inspected the generated combobox options code using firebug extension on firefox and they are ok; on IE7 the options for the second combo are being populated without errors, but it is crashing after I select an option on the first combobox that only have 1 option asociated in the second combobox and then try to open the second combobox; IE7 crash and is displaying a messages that reads "IE7 has stop responding bla bla....".
Just in case you do not fully understand: my problem only ocurrs if there is only one option on the second combobox, if there are 2+ the problem does not ocurr.
The first combobox has the function setDynaList attached to the OnChange event..
Here are my javascripts functions:
-----------------------------------------------------------
and here is the array that dinamically I and wrting to the page reading from the database:
in the array every 3 elements the first element is the parent id(the selected value on the first combobox), the second is the value and the third is the name for the option on the second combobox.
any Idea?
I am having a problem with to linked comboxes in IE7. Here is my problem that is ONLY ocurring in IE7: I have javascripts functions to populate the second of 2 comboxes given the selected option on the first one; the scripts look to be ok since they work perfectly on firefox 3.08 and also on IE6 and IE8; I have inspected the generated combobox options code using firebug extension on firefox and they are ok; on IE7 the options for the second combo are being populated without errors, but it is crashing after I select an option on the first combobox that only have 1 option asociated in the second combobox and then try to open the second combobox; IE7 crash and is displaying a messages that reads "IE7 has stop responding bla bla....".
Just in case you do not fully understand: my problem only ocurrs if there is only one option on the second combobox, if there are 2+ the problem does not ocurr.
The first combobox has the function setDynaList attached to the OnChange event..
Here are my javascripts functions:
Code:
function setDynaList(cbx1, cbx2, arr, addFirstOption){
var oList1 = document.getElementById(cbx1);
var oList2 = document.getElementById(cbx2);
clearDynaList(oList2);
if (oList1.selectedIndex == -1){
oList1.selectedIndex = 0;
}
populateDynaList(oList2, oList1[oList1.selectedIndex].value, arr, addFirstOption);
return true;
}
function clearDynaList(oList){
oList.selectedIndex = -1;
for (var i = oList.options.length; i >= 0; i--){
oList.options[i] = null;
}
oList.selectedIndex = -1;
}
function populateDynaList(oList, nIndex, aArray, addFirstOption){
if (addFirstOption == true) {
var aOption;
aOption = document.createElement("OPTION");
aOption.value = '';
aOption.text = '- select -';
oList.options.add(aOption);
}
for (var i = 0; i < aArray.length; i= i + 3){
if (aArray[i] == nIndex){
aOption = document.createElement("OPTION");
aOption.value = aArray[i + 1];
aOption.text = aArray[i + 2];
oList.options.add(aOption);
}
}
if (oList.options.length > 0) {
oList.selectedIndex = 0;
} else {
oList.selectedIndex = -1;
}
}
function setDefaListbyValue(sList, sDefault){
oList = document.getElementById(sList);
var found = false;
for (var i = 0; ((i < oList.options.length) && (!found)) ; i++){
if (oList.options[i].value == sDefault){
oList.options[i].setAttribute('selected', 'true');
oList.options[i].selected = true;
found = true;
}
}
}
function setDefaListbyText(sList, sDefault){
oList = document.getElementById(sList);
var found = false;
for (var i = 0; ((i < oList.options.length) && (!found)) ; i++){
if (oList.options[i].text == sDefault){
oList.options[i].setAttribute('selected', 'true');
oList.options[i].selected = true;
found = true;
}
}
}
function setupDefaList(sList, sDefault, nIndex, aArray, addFirstOption){
oList = document.getElementById(sList);
clearDynaList(oList);
populateDynaList(oList, nIndex, aArray, addFirstOption);
setDefaListbyText(sList, sDefault);
}
and here is the array that dinamically I and wrting to the page reading from the database:
Code:
<script type="text/javascript">
//<![CDATA[
var MyItemsArray = new Array('6','16687','Furniture for care, play and learning', '6','16688','Furnishings for relaxation', '6','16689','Room arrangement', '6','16690','Space for privacy', '6','16691','Child-related display', '6','16692','Space for gross motor', '6','16693','Gross motor equipment', '7','16694','Meals/snacks', '7','16695','Nap/rest', '7','16696','Toileting/diapering', '7','16697','Health practices', '7','16698','Safety practices', '8','16699','Books and pictures', '9','16700','Art', '9','16701','Music / movement', '9','16702','Blocks', '9','16703','Sand / water', '9','16704','Dramatic play', '9','16705','Nature / science', '9','16706','Use of TV, video, and/or computers', '9','16707','Promoting acceptance of diversity', '10','16708','General supervision of children', '11','16709','Schedule', '11','16710','Free play', '11','16711','Group time', '11','16712','Provisions for children with disabilities');
//]]>
</script>
any Idea?
Comment