IsDefined

This is a discussion on IsDefined within the Cold Fusion forums in Application Servers & Tools category; At server side I want to check form collection or Url collection. I used cfdump to know content of "FORM" and "URL" , it shows me struct[empty strings]. How I would determin these structures are empty? I used isdefined("FORM") but it is not working. Is there any way to determing FROM and URL string are empty or set? Thaks in advance ThePolarExpress............ :light;...

Go Back   Application Development Forum > Application Servers & Tools > Cold Fusion

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-27-2008, 04:58 PM
thepolarexpress
Guest
 
Default IsDefined

At server side I want to check form collection or Url collection. I used
cfdump to know content of "FORM" and "URL" , it shows me struct[empty
strings]. How I would determin these structures are empty?

I used isdefined("FORM") but it is not working. Is there any way to determing
FROM and URL string are empty or set?

Thaks in advance

ThePolarExpress............


:light;

Reply With Quote
  #2  
Old 08-27-2008, 05:16 PM
Ian Skinner
Guest
 
Default Re: IsDefined


structkIsEmpty() OR structCount() will probably work for what you want.
Reply With Quote
  #3  
Old 08-27-2008, 05:21 PM
-==cfSearching==-
Guest
 
Default Re: IsDefined

I believe the FORM and URL structures always exist. To determine if they are empty, try the StructIsEmpty function.
http://livedocs.adobe.com/coldfusion...s/00000643.htm
Reply With Quote
  #4  
Old 08-27-2008, 05:27 PM
Adam Cameron
Guest
 
Default Re: IsDefined

> I used isdefined("FORM") but it is not working.

Well they always exist, so that's not the best approach.


> Is there any way to determing
> FROM and URL string are empty or set?


Have a read through the docs for functions relating to structures.
structCount() is probably the closest one to what you're asking. Or
structKeyArray() or something.

--
Adam
Reply With Quote
  #5  
Old 08-28-2008, 10:58 AM
thepolarexpress
Guest
 
Default Re: IsDefined

Thanks a lot ...

Form and url structure not exist if you visit server side processing page
directly. So before refering these varaibles code you have to varify there
existance.

I check with structIsEmpty() but it didn't work out . Getting soem java.map
interface error. I achives same result by checking
isdefined("form.fieldnames"). But this doesn't work for URL.

Anybody having any idea how to verify URL is empty or not?

Thanks
The PolarExpress...



:music;

<cfif isdefined("form.fieldnames") is false>
<cfoutput>"this is test"</cfoutput>
<cfif isdefined("URL") is false >
<cfoutput><br>"this is url test"</cfoutput>
<cfelse>
<cfoutput><br>"Exist this is url test"</cfoutput>
</cfif>
<cfelse>
<CFOUTPUT>
<hr>

<li>#FORM.fieldnames#</li>
<li>Last Name:#htmleditformat(form.lastname)#</li>
<li>First Name:#form.firstname#</li>
<li>Gender:#form.gender#</li>
<li>Salary:#form.salary#</li>
<br><br>
<cfloop index="Item" list=#FORM.fieldnames#>
#Item# <Br>
</cfloop>

</CFOUTPUT>
</cfif>

Reply With Quote
  #6  
Old 08-28-2008, 11:00 AM
Dan Bracuk
Guest
 
Default Re: IsDefined

[q]Originally posted by: thepolarexpress
Thanks a lot ...
Anybody having any idea how to verify URL is empty or not?
[/q]
len(cgi.querystring)

Reply With Quote
  #7  
Old 08-28-2008, 11:11 AM
thepolarexpress
Guest
 
Default Re: IsDefined

[q]Originally posted by: Dan Bracuk
[Q]Originally posted by: thepolarexpress
Thanks a lot ...
Anybody having any idea how to verify URL is empty or not?
[/Q]
len(cgi.querystring)
[/q]

This doesn't work for URL, when form posted with "GET" method then
len(cgi.querystring) is zero.
Also Why I am getting an error The value of the parameter 1, which is
currently "URL", must be a interface java.util.Map value while checking
StructIsEmpty("URL")




Reply With Quote
  #8  
Old 08-28-2008, 04:46 PM
Adam Cameron
Guest
 
Default Re: IsDefined

> Form and url structure not exist if you visit server side processing page
> directly.


I don't understand what you mean by that. As opposed to "indirectly"?

--
Adam
Reply With Quote
  #9  
Old 08-29-2008, 08:37 AM
thepolarexpress
Guest
 
Default Re: IsDefined

1. data input form cfm
2. data process from cfm

Thanks !!

Ther is possiblity in my application user come to data process form without
visiting data input form. In that case my application throwing an error beacuse
I am not verify Form and URL filed are empy.

so my question is how do we check weather FORM and URL contain any fields or
not. I found soln for FORM but not for URL. The URL doesn't have property like
fieldnames.

So question here How do you identify URL contain anything or it is a blank.

p.s. My application problem can be resolved other ways i.e. by checking http
referer or there are other ways around...

Thanks in advance ..

The Polar Express




:clock;

Reply With Quote
  #10  
Old 08-29-2008, 08:38 AM
thepolarexpress
Guest
 
Default Re: IsDefined

[q]Originally posted by: thepolarexpress

Thanks !!

1. data input form cfm
2. data process form cfm



Ther is possiblity in my application user come to data process form without
visiting data input form. In that case my application throwing an error beacuse
I am not verify Form and URL filed are empy.

so my question is how do we check weather FORM and URL contain any fields or
not. I found soln for FORM but not for URL. The URL doesn't have property like
fieldnames.

So question here How do you identify URL contain anything or it is a blank.

p.s. My application problem can be resolved other ways i.e. by checking http
referer or there are other ways around...

Thanks in advance ..

The Polar Express




:clock;[/q]



Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 07:41 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.