G
Greg Scharlemann
I am attempting to populate a drop down menu based on the selection of
a different drop down menu. However, it is not working correctly, I
cannot figure out for the life of me what exactly happens because I am
not getting any errors on the page.
<html>
<script language="javascript">
var phaseArray = new phaseArray(4);
var phaseTypeId = new phaseTypeId(4);
var phaseId = new phaseId(4);
phaseArray[0] = "Define";
phaseId[0] = "phs_200300000001";
phaseTypeId[0] = "pht_200300000001";
phaseArray[1] = "Measure";
phaseId[1] = "phs_200300000002";
phaseTypeId[1] = "pht_200300000001";
phaseArray[2] = "Analyze";
phaseId[2] = "phs_200300000003";
phaseTypeId[2] = "pht_200300000001";
phaseArray[3] = "Project Start-Up";
phaseId[3] = "phs_200300000006";
phaseTypeId[3] = "pht_200300000002";
function populateMenu(s) {
//document.write(phastTypeId[1]);
//document.write(s);
var i=0,j=1;
document.overview.phase.options.length = 1; //delete current
options
document.overview.phase.options[0].selected = true;
for (var i=0; i<phaseArray.length; i++){
if(s == phaseTypeId) {
document.overview.phase.options.length = j;
document.overview.phase.options[j] = new Option(phaseArray);
document.overview.phase.options[j].value = phaseId;
//if( == phaseArray)
// document.searchForm.metroID2.options[j].selected = true;
j++;
}
}
}
</script>
<body>
<form name="overview" id="overview" action="test2.jsp"
method="post">
<select name="phaseType"
onChange="populateMenu(document.overview.phaseType.options[document.overview.phaseType.options.selectedIndex].value);">
<option value="-1">- select phase -</option>
<option value="pht_200300000001">Phase 1</option>
<option value="pht_200300000002">Phase 2</option>
</select><br />
<select name="phase" id="phase" style="width:100px;">
<option></option>
</select>
</form>
</body>
</html>
There maybe a simple solution to this. I am not extremely familiar
with Javascript and may have made some sort of syntax error. Thanks
all.
a different drop down menu. However, it is not working correctly, I
cannot figure out for the life of me what exactly happens because I am
not getting any errors on the page.
<html>
<script language="javascript">
var phaseArray = new phaseArray(4);
var phaseTypeId = new phaseTypeId(4);
var phaseId = new phaseId(4);
phaseArray[0] = "Define";
phaseId[0] = "phs_200300000001";
phaseTypeId[0] = "pht_200300000001";
phaseArray[1] = "Measure";
phaseId[1] = "phs_200300000002";
phaseTypeId[1] = "pht_200300000001";
phaseArray[2] = "Analyze";
phaseId[2] = "phs_200300000003";
phaseTypeId[2] = "pht_200300000001";
phaseArray[3] = "Project Start-Up";
phaseId[3] = "phs_200300000006";
phaseTypeId[3] = "pht_200300000002";
function populateMenu(s) {
//document.write(phastTypeId[1]);
//document.write(s);
var i=0,j=1;
document.overview.phase.options.length = 1; //delete current
options
document.overview.phase.options[0].selected = true;
for (var i=0; i<phaseArray.length; i++){
if(s == phaseTypeId) {
document.overview.phase.options.length = j;
document.overview.phase.options[j] = new Option(phaseArray);
document.overview.phase.options[j].value = phaseId;
//if( == phaseArray)
// document.searchForm.metroID2.options[j].selected = true;
j++;
}
}
}
</script>
<body>
<form name="overview" id="overview" action="test2.jsp"
method="post">
<select name="phaseType"
onChange="populateMenu(document.overview.phaseType.options[document.overview.phaseType.options.selectedIndex].value);">
<option value="-1">- select phase -</option>
<option value="pht_200300000001">Phase 1</option>
<option value="pht_200300000002">Phase 2</option>
</select><br />
<select name="phase" id="phase" style="width:100px;">
<option></option>
</select>
</form>
</body>
</html>
There maybe a simple solution to this. I am not extremely familiar
with Javascript and may have made some sort of syntax error. Thanks
all.