I have two dropdownlists where one is updated by what is picked in the other. I am using AJAX to retrieve data from my data server, writing it to xml, and then creating the options in the second dropdownlist. Everything works until I submit my form. The second dropdownlist's selectedIndex value is always 0, no matter which option I choose in the list. Has anyone else had this problem?
function ClearAndSetInspectorList(InsCoNode)
{
var InspList = document.getElementById("ddlInspector");
for(var count = InspList.options.length-1; count > -1; count--)
{
InspList.options[count] = null;
}
var txtVal;
var val;
var InspNodes = InsCoNode.getElementsByTagName('Inspector');
InspList.options.length = InspNodes.length;
InspList.options[0].text = "Select Inspector...";
for (var Count=1;Count < InspNodes.length; Count++)
{
txtVal = InspNodes[Count].getAttribute("InspName");
val = InspNodes[Count].getAttribute("InspNum");
InspList.options[Count].text = val + ": " + txtVal;
InspList.options[Count].value = val;
}
}
function ClearAndSetInspectorList(InsCoNode)
{
var InspList = document.getElementById("ddlInspector");
for(var count = InspList.options.length-1; count > -1; count--)
{
InspList.options[count] = null;
}
var txtVal;
var val;
var InspNodes = InsCoNode.getElementsByTagName('Inspector');
InspList.options.length = InspNodes.length;
InspList.options[0].text = "Select Inspector...";
for (var Count=1;Count < InspNodes.length; Count++)
{
txtVal = InspNodes[Count].getAttribute("InspName");
val = InspNodes[Count].getAttribute("InspNum");
InspList.options[Count].text = val + ": " + txtVal;
InspList.options[Count].value = val;
}
}