![MACROMEDIA COLFUSION MX 7 - INSTALLING AND USING COLDFUSION MX Reference Download Page 670](http://html1.mh-extra.com/html/macromedia/colfusion-mx-7-installing-and-using-coldfusion-mx/colfusion-mx-7-installing-and-using-coldfusion-mx_reference_687505670.webp)
670
Chapter 3: ColdFusion Functions
IsDefined
Description
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.
Returns
True, if the variable is found, or, for a structure, if the specified key is defined; False, otherwise.
The return value is 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.
Category
Decision functions
Function syntax
IsDefined
("
variable_name
")
See also
Evaluate
History
ColdFusion MX: Changed behavior: this function can process only the following constructs:
•
A simple variable
•
A named variable with dot notation
•
A named structure with dot notation (for example:
mystruct.key
)
Parameters
Usage
When working with scopes that ColdFusion exposes as structures, the
StructKeyExists
function can sometimes replace this
function. The following lines are equivalent:
if(isDefined("form.myVariable"))
if(structKeyExists(form,"myVariable"))
Example
<cfif IsDefined("form.myString")>
<p>The variable form.myString has been defined, so show its contents.
This construction allows us to place a form and its resulting action code
on the same page and use IsDefined to control the flow of execution.</p>
<p>The value of "form.myString" is <b><i>
<cfoutput>#form.myString#</cfoutput></i></b>
<cfelse>
Parameter
Description
variable_name
String, enclosed in quotation marks. Name of variable to test for.
Summary of Contents for COLFUSION MX 7 - INSTALLING AND USING COLDFUSION MX
Page 1: ...COLDFUSION MX7 CFML Reference...
Page 20: ...20 Chapter 1 Reserved Words and Variables...
Page 50: ...50 Chapter 2 ColdFusion Tags cfelse br Searching cfif cfloop cfif...
Page 101: ...cfdefaultcase 101 cfdefaultcase cfswitch cfoutput Your grade is grade cfoutput...
Page 115: ...cfdocumentsection 115 cfdocumentsection cfoutput cfdocument...
Page 411: ...cftable 411 cftable body html...
Page 515: ...Chr 515 maxlength 5 p input type Submit name input type RESET cfform...
Page 605: ...GetEncoding 605 WriteOutput The encoding is theEncoding cfscript cfif...
Page 629: ...GetProfileString 629 tr td input type Submit name Submit value Submit td td td tr table form...
Page 655: ...IIf 655 cfoutput IIf Hour Now GTE 12 DE It is afternoon or evening DE It is morning cfoutput b...
Page 664: ...664 Chapter 3 ColdFusion Functions cfelse h3 Conversion error h3 cfif...
Page 687: ...IsStruct 687 cfoutput cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Page 751: ...LSDateFormat 751 hr noshade cfoutput cfloop...
Page 861: ...StructFind 861 cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Page 903: ...Val 903 value Is the beginning numeric name form...
Page 932: ...932 Chapter 3 ColdFusion Functions...
Page 944: ...944 Chapter 4 ColdFusion MX Flash Form Style Reference...
Page 962: ...962 Chapter 5 Application CFC Reference...
Page 1054: ...1054 Chapter 6 ColdFusion MX Event Gateway Reference...