Name

IsDefined

Synopsis

IsDefined('variable_name')

Determines if the specified variable exists. Returns True if the specified variable exists or False if it doesn’t. Note that IsDefined( ) replaces the deprecated ParameterExists( ) function. Examples:

<CFSET MyVar="Variable">
<CFSET Form.MyFormVar="Form Variable">

<CFOUTPUT>
<CFIF IsDefined('MyVar')>
  Variable MyVar exists:<BR> MyVar = #MyVar#
<CFELSE>
  No variable called MyVar exists.
</CFIF>
<P><CFIF IsDefined('MyFormVar')>
  Variable MyFormVar exists:<BR> MyFormVar = #MyFormVar#
<CFELSE>
  No variable called MyFormVar exists.
</CFIF>
<P><CFIF IsDefined('Queryname.field')>
  Variable Queryname.Field exists:<BR> QueryName.Field = #Queryname.Field#
<CFELSE>
  No variable called Queryname.Field exists.
</CFIF>
</CFOUTPUT>

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.