A
ATS
PRB JavaScript in ASP with Request.Form
Please help,
I'm having a problem with JavaScript in ASP, where the ASP page crashes when
I try to determine if data was posted from a FORM or through a QueryString.
Where, if the data came through via a FORM, I want to use it 1st, but if not,
to then try using it from the QueryString. Basically, the problem boils down
to using "toString()" on Request.Form("NAME") and Request.QueryString("NAME")
as such:
Post to this page as: TST.asp?STATE=TEST
<%@ Language=JavaScript %>
<%
Response.AddHeader("Pragma", "No-Cache");
%>
<%
var oThis = Request.Form("STATE");
var csResults;
if ((oThis == null) || (typeof(oThis) == "undefined"))
{
csResults = "NULL";
}
else
{
csResults = oThis.toString(); // ASP Crashes here. Why?!??!
}
%>
<html>
<%=csResults%>
</html>
That code crashes at the "toString()" call, which should not be. JavaScript
says all "Object" types have "toString" in them, but both
Request.Form("NAME") and Request.QueryString("NAME") do not seem to have them.
What can be done?
Please help,
I'm having a problem with JavaScript in ASP, where the ASP page crashes when
I try to determine if data was posted from a FORM or through a QueryString.
Where, if the data came through via a FORM, I want to use it 1st, but if not,
to then try using it from the QueryString. Basically, the problem boils down
to using "toString()" on Request.Form("NAME") and Request.QueryString("NAME")
as such:
Post to this page as: TST.asp?STATE=TEST
<%@ Language=JavaScript %>
<%
Response.AddHeader("Pragma", "No-Cache");
%>
<%
var oThis = Request.Form("STATE");
var csResults;
if ((oThis == null) || (typeof(oThis) == "undefined"))
{
csResults = "NULL";
}
else
{
csResults = oThis.toString(); // ASP Crashes here. Why?!??!
}
%>
<html>
<%=csResults%>
</html>
That code crashes at the "toString()" call, which should not be. JavaScript
says all "Object" types have "toString" in them, but both
Request.Form("NAME") and Request.QueryString("NAME") do not seem to have them.
What can be done?