And I get the error ...">

ColdFusion isDefined getting undefined error

I have:

<cfif not isDefined(activity)>
    <cfset activity="">
</cfif>

      

And I get the error :: "Variable ACTIVITY undefined."

AND?

Oh, and the error is with isDefined

, not with cfset

.

+3


source to share


3 answers


isDefined takes a variable name , not the variable itself:



<cfif not isDefined("activity")>
    <cfset activity="">
</cfif>

      

+9


source


Try:



<cfif structKeyExists(VARIABLES, 'Activity')>
<cfset Activity = "Something" />
</cfif>

      

+4


source


We can use like this

<cfif not structKeyExists(variables,"Activity")>
    <cfset Activity = "">
</cfif>

      

-1


source







All Articles