Skip to main content
Known Participant
August 27, 2008
Answered

IsDefined

  • August 27, 2008
  • 3 replies
  • 1414 views

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............


    This topic has been closed for replies.
    Correct answer -__cfSearching__-
    structIsEmpty() doesn't work for [structIsEmpty("Form") For Me its throwing some java exception...

    FYI
    I just joined cold fusion world few weeks back and making changes in on going application, I am refering devloper guide and refernce which I downloaded from adobe web site. I apploguize for making some false comment





    Thanks
    ThePolarExpress

    quote:

    Originally posted by: Newsgroup User
    > 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.

    Sure. But you've been given the answer to this by Ian and myself already.

    --
    Adam



    Text

    thepolarexpress wrote:
    > structIsEmpty() doesn't work for [structIsEmpty("Form") For Me its throwing some java exception...

    You are using the function incorrectly. The quotes cause ColdFusion to treat the value as a string. ie The literal word "Form". That causes an error because the function expects a structure object, not a string.

    Remove the quotes around FORM.

    <cfif structIsEmpty(FORM)>
    it is empty
    <cfelse>
    not empty
    </cfif>

    3 replies

    Inspiring
    August 27, 2008
    > 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
    Inspiring
    August 27, 2008
    I believe the FORM and URL structures always exist. To determine if they are empty, try the StructIsEmpty function.
    http://livedocs.adobe.com/coldfusion/7/htmldocs/00000643.htm
    Inspiring
    August 27, 2008

    structkIsEmpty() OR structCount() will probably work for what you want.
    Known Participant
    August 28, 2008
    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...



    Inspiring
    August 28, 2008
    quote:

    Originally posted by: thepolarexpress
    Thanks a lot ...
    Anybody having any idea how to verify URL is empty or not?


    len(cgi.querystring)