How do I test for an Undefined variable? 
Author Message
 How do I test for an Undefined variable?

I have an ASP page that is retrieving a QueryString variable, if the item
does not exist in the QueryString the variable appears to be Undefined. How
do I test for this occurrence as I have tried the following with no joy...

RequestedTransaction = Request.QueryString("TransactionId");

if (RequestedTransaction == "undefined")
{

... etc

if (RequestedTransaction == "")
{

... etc

if (RequestedTransaction == null)
{

...

None of these seem to work. Any ideas.

Cheers in advance

Stephen



Fri, 07 Feb 2003 03:00:00 GMT  
 How do I test for an Undefined variable?

Hi

if(Request.QueryString("bla").Count < 1)
if(Request.QueryString("bla") + "" == "undefined")

--
Best Regards
 Vidar Petursson
==============================
  Microsoft Internet, Client, SDK MVP
==============================
 http://www.icysoft.com
 http://www.dna.is



==============================
 No matter where you go there you are
-


Quote:
> I have an ASP page that is retrieving a QueryString variable, if the item
> does not exist in the QueryString the variable appears to be Undefined.
How
> do I test for this occurrence as I have tried the following with no joy...

> RequestedTransaction = Request.QueryString("TransactionId");

> if (RequestedTransaction == "undefined")
> {

> ... etc

> if (RequestedTransaction == "")
> {

> ... etc

> if (RequestedTransaction == null)
> {

> ...

> None of these seem to work. Any ideas.

> Cheers in advance

> Stephen



Fri, 07 Feb 2003 03:00:00 GMT  
 How do I test for an Undefined variable?

"Vidar Petursson" wrote ...

Quote:
> Hi

> if(Request.QueryString("bla").Count < 1)
> if(Request.QueryString("bla") + "" == "undefined")

How about ...

if(typeof(fred) == "undefined")

Paul



Sat, 08 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Variable undefined test in I.E. 5

2. how do you test myVar != undefined

3. undefined object variable

4. Is a variable undefined?

5. Checking if variable is undefined

6. variable is undefined - why?

7. Undefined variable?

8. is undefined, undefined?

9. usage of undefined and "undefined"

10. Testing Acess Yes/No Variables Types

11. Testing for omitted query string variables, how?

12. Variables in File Exists Tests Possible??

 

 
Powered by phpBB® Forum Software