[thelist] JS Code Execution Ends Prematurely with no error....
Dan Parry
dan at virtuawebtech.co.uk
Fri Mar 24 04:27:24 CST 2006
Not a solution as such, but have you tried Firefox with the Firebug
extension?
Normally javascript errors aren't reported very well for Ajax related faults
but Firebug is capable of tracking this type of problem
It's helped me no end :)
Just a thought
HTH
Dan
-----------------------------------------------------
Dan Parry
Senior Developer
Virtua Webtech Ltd
http://www.virtuawebtech.co.uk
-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Anthony Baratta
Sent: 24 March 2006 00:00
To: thelist at lists.evolt.org
Subject: [thelist] JS Code Execution Ends Prematurely with no error....
Howdy...
I'm working on a "psuedo-object" within Javascript that uses AJAX to
populate several drop down menus based upon the selection of a primary drop
down.
For some reason the code stops executing after a specific point but does not
throw an error. I can't show the full page or code since it's on an intranet
- but here's a few key lines that I hope will be helpful.
Below look for the two alert calls:
alert("options start (" + this.sID + ")");
alert("options end (" + this.sID + ")");
The first one executes fine.The second never does. The drop downs are
populated correctly but the code does not execute further than the for next
look betwen the two alerts. The for/next loop is the last thing executed in
"fillSelect".
Any ideas? If you need more info, let me know.
// Build new JS select object
var objFltSelect = new objSelect('fltID');
objFltSelect.rebuildSelect(sValue);
// JS Select Object Code
function objSelect(selectID)
{
this.sID = selectID;
this.oSelect = document.getElementById(selectID);
this.rebuildSelect = function (sValue)
{
this.oSelect.disabled = false;
this.oSelect.options.length = 0;
this.appendSelect("*", this.selectMessage(this.sID));
this.oSelect.disabled = true;
if (sValue.trim() != "")
{
this.sQueryString = "?a=select" + escape(this.sID) +
"&v=" + escape(sValue);
this.cObj = WAMU.util.Connect.asyncRequest('GET',
'./SelectRep_Ajax.asp' + this.sQueryString, this.callBack, null);
}
};
this.fillSelect = function(sResponseText)
{
this.aValues = sResponseText.split("||");
this.oSelect.disabled = false;
this.appendSelect("*", "--------------------");
// This alert executes
alert("options start (" + this.sID + ")");
for (var x = 0; x <= this.aValues.length; x++)
{
this.aOptions = this.aValues[x].split("??");
this.appendSelect(this.aOptions[0], this.aOptions[1]);
};
// This alert does not execute
alert("options end (" + this.sID + ")");
};
this.appendSelect = function(sValue, sText)
{
this.oOption = document.createElement("option");
this.oOption.value = sValue;
this.oOption.text = sText;
if (ie)
{
this.oSelect.add(this.oOption);
} else {
this.oSelect.add(this.oOption, null);
};
};
this.responseSuccess = function(o)
{
if (o.responseText.trim() != "")
{
this.fillSelect(o.responseText.trim());
}
//o.responseText
//o.argument
};
this.responseFailure = function(o)
{
document.getElementById("ErrorMsg").innerHTML =
o.statusText;
this.oSelect.disabled = true;
//o.statusText
};
this.callBack =
{
success : this.responseSuccess,
failure : this.responseFailure,
scope: this,
argument: "dummy value"
};
this.selectMessage = function()
{
this.message = "";
switch(this.sID)
{
case "locID":
this.message = "-- Select a Location --";
break;
case "mgrID":
this.message = "-- Select a Manager --";
break;
case "fltID":
this.message = "-- Reviewing Organization --";
break;
}
return this.message;
};
this.defaultSelect = function()
{
this.sIndex = 0;
switch(this.sID)
{
case "fltID":
this.sIndex = 2;
break;
}
return this.sIndex;
}
}
--
* * Please support the community that supports you. * *
http://evolt.org/help_support_evolt/
For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !
More information about the thelist
mailing list