Evaluates a string value to determine whether the variable named in it exists.
This function is an alternative to the ParameterExists function, which is deprecated.
True, if the variable is found, or, for a structure, if its key is defined; False, otherwise.
Returns False for an array or structure element referenced using bracket notation. For example, IsDefined("myArray[3]") always returns False, even if the array element myArray[3] has a value.
IsDefined("variable_name")
New in ColdFusion MX: this function can process only the following constructs:
mystruct.key)| Parameter | Description |
|---|---|
| variable_name |
String, enclosed in quotation marks. Name of variable to test for. |
When working with the URL and Form scopes, which are structures, the StructKeyExists function can sometimes be used in place of this function. The following blocks of code are equivalent:
<h3>IsDefined Example</h3>
<cfif IsDefined("FORM.myString")>
<p>Because the variable FORM.myString is defined, we can show its contents.
This lets us put a FORM and its resulting action page in the same page,
while using IsDefined to control the flow of page execution.
<p>The value of "FORM.myString" is <B><I><cfoutput>#FORM.myString#
</cfoutput></I></B>
<cfelse>
<p>During the first execution of this page, the variable "FORM.myString" is
not yet defined, so it is not evaluated.
</cfif>
...
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6
Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt1130.htm
Comments
bruceschuman said on Jun 12, 2002 at 6:59 PM : bruceschuman said on Jun 12, 2002 at 7:02 PM : ctina said on Jul 19, 2002 at 12:51 PM : hallow said on Jan 8, 2003 at 12:44 PM : Corey Gilmore said on Feb 6, 2004 at 3:04 PM :