J
jr
I have 3 fields bu, zonenm and zoneid, the bu is populated by a sql
query, the other two are dynamically populated by related drop down
lists using AJAX. The scripts for the next pull down is triggered by
the onChange event in the input tag for the one below it. The scripts
work but there is one small issue. The zonenm works because the
onChange() event triggers it from the bu input tag. The zoneid sticks
until you change the drop down because of the onChange ig appears to
the user there are no zoneid's for that zonenm. That is becuase the
zoneid should automatically populate for the zoneid in the search box
when there is a related value in the zonenm. The onChange event in
the input line for the zonenm is wrong because it doesn't need to
wait, so my question is how to trigger it automatically once the
zonenm is populated?
thanks,
function fillZoneNm() {
var bu = document.forms[0].search_bu.value;
if ( window.XMLHttpRequest ) {// code for IE7+,
Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else{ // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
document.getElementById("search_zonenm").innerHTML=xmlhttp.responseText;
}
xmlhttp.open("GET","get_bus.php?bu="+bu,true);
//xmlhttp.open("GET","get_bus.php?bu=" + bu,true);
xmlhttp.send();
}
function fillZoneId() {
var bu = document.forms[0].search_bu.value;
alert(bu);
var zonenm = document.forms[0].search_zonenm.value;
alert(zonenm)
if ( window.XMLHttpRequest ) {// code for IE7+,
Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else{ // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
document.getElementById("search_zoneid").innerHTML=xmlhttp.responseText;
}
xmlhttp.open("GET","get_zonenms.php?bu="+bu
+"&zonenm="+zonenm,true);
xmlhttp.send();
}
query, the other two are dynamically populated by related drop down
lists using AJAX. The scripts for the next pull down is triggered by
the onChange event in the input tag for the one below it. The scripts
work but there is one small issue. The zonenm works because the
onChange() event triggers it from the bu input tag. The zoneid sticks
until you change the drop down because of the onChange ig appears to
the user there are no zoneid's for that zonenm. That is becuase the
zoneid should automatically populate for the zoneid in the search box
when there is a related value in the zonenm. The onChange event in
the input line for the zonenm is wrong because it doesn't need to
wait, so my question is how to trigger it automatically once the
zonenm is populated?
thanks,
function fillZoneNm() {
var bu = document.forms[0].search_bu.value;
if ( window.XMLHttpRequest ) {// code for IE7+,
Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else{ // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
document.getElementById("search_zonenm").innerHTML=xmlhttp.responseText;
}
xmlhttp.open("GET","get_bus.php?bu="+bu,true);
//xmlhttp.open("GET","get_bus.php?bu=" + bu,true);
xmlhttp.send();
}
function fillZoneId() {
var bu = document.forms[0].search_bu.value;
alert(bu);
var zonenm = document.forms[0].search_zonenm.value;
alert(zonenm)
if ( window.XMLHttpRequest ) {// code for IE7+,
Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else{ // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
document.getElementById("search_zoneid").innerHTML=xmlhttp.responseText;
}
xmlhttp.open("GET","get_zonenms.php?bu="+bu
+"&zonenm="+zonenm,true);
xmlhttp.send();
}