PRB JavaScript in ASP with Request.Form

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:

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.

The issue is that the ASP/JavaScript is not returning a string for
Request.Form("STATE"). In fact, using "typeof(Request.Form("STATE"))" returns
"object". Is there any kind of CStr function available like in VB? By the
way, I do not want to switch to VBScript.

=?Utf-8?B?QVRT?= wrote on 22 mrt 2007 in
microsoft.public.inetserver.asp.general:
> Thanks Evertjan for helping, but I found the problem.
>
> With Request.Form and Request.QueryString with JavaScript, one needs
> to use ".Item" to make it return the string or undefined/null object.
>
> Example:
>
> var csTST = Request.Form("STATE").Item;
>
>

Well done!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!