D
David Lee Lambert
I'm trying to auto-populate later parts of a form based on what's
typed in an earlier part. The following code behaves the way I'd like
in Konqueror and Safari. In Firefox 2.0, it seems like it sets the
status bar with "Searching for...", but never makes the alert() call.
I have the error console open and don't see any errors. I can see in
my web-server logs that it's sending a "200 OK" response to that
request.
window.status = "Searching for vehicle '"+vin+"' in Waybill...";
var win = window;
var req = createXMLHttpRequest();
req.open("GET", "wbVinLookupData.jsp?VIN="+vin, false, null, null);
req.onreadystatechange = function () {
if(req.readyState == 4) {
alert(req.responseText);
var vehicles = [];
try {
vehicles = eval('('+req.responseText+')').vehicles;
} catch (err) {
vehicles = [];
}
Up to that point it works OK in IE 7 as well. Next I act differently
based on the number of returned vehicles:
if (vehicles.length==0) {
alert("VIN '"+vin+"' not found in Waybill!");
} else if (vehicles.length==1) {
var vehicle = vehicles[0];
setVinInfo(win,
vehicle.VIN,
vehicle.customer,
vehicle.location);
win.document.getElementById(
"wbModelInfo").innerHTML = vehicle.modelInfo;
} else {
win.open("chooseVin.jsp?VIN="+vin,
"chooseVin",
"height=300,width=400,scrollbars");
}
}
With IE7, I always get the first ("VIN not found") case, even if I
can see that the returned array has one or several vehicle records.
Does anyone have an idea of the solution to either of these problems?
--
David Lee Lambert
Software Developer, Precision Motor Transport Group, LLC
work phone 517-349-3011 x223
cell phone 586-873-8813
e-mail (e-mail address removed)
typed in an earlier part. The following code behaves the way I'd like
in Konqueror and Safari. In Firefox 2.0, it seems like it sets the
status bar with "Searching for...", but never makes the alert() call.
I have the error console open and don't see any errors. I can see in
my web-server logs that it's sending a "200 OK" response to that
request.
window.status = "Searching for vehicle '"+vin+"' in Waybill...";
var win = window;
var req = createXMLHttpRequest();
req.open("GET", "wbVinLookupData.jsp?VIN="+vin, false, null, null);
req.onreadystatechange = function () {
if(req.readyState == 4) {
alert(req.responseText);
var vehicles = [];
try {
vehicles = eval('('+req.responseText+')').vehicles;
} catch (err) {
vehicles = [];
}
Up to that point it works OK in IE 7 as well. Next I act differently
based on the number of returned vehicles:
if (vehicles.length==0) {
alert("VIN '"+vin+"' not found in Waybill!");
} else if (vehicles.length==1) {
var vehicle = vehicles[0];
setVinInfo(win,
vehicle.VIN,
vehicle.customer,
vehicle.location);
win.document.getElementById(
"wbModelInfo").innerHTML = vehicle.modelInfo;
} else {
win.open("chooseVin.jsp?VIN="+vin,
"chooseVin",
"height=300,width=400,scrollbars");
}
}
With IE7, I always get the first ("VIN not found") case, even if I
can see that the returned array has one or several vehicle records.
Does anyone have an idea of the solution to either of these problems?
--
David Lee Lambert
Software Developer, Precision Motor Transport Group, LLC
work phone 517-349-3011 x223
cell phone 586-873-8813
e-mail (e-mail address removed)