This syntax won't work either... it would have to be
isDefined(authTest) which would check for the existsance of a variable
which matches the value of the string authTest instead of
isdefined("authTest") which in this case will always evaluate true
since you've just defined the variable "authTest" on the previous
line.

The reason why isdefined() is producing an error is because
"synatically valid" variable names can't begin with digits (although
structure keys can) -- so you could do one of two things, you could
prefix the number with a letter like #session.auth.aid_100824# or you
could as Paul Hastings suggested (and as I typically suggest) use
#structkeyexists(session.auth,"100824")#

hth

s. isaac dealey                972-490-6624

team macromedia volunteer      http://www.macromedia.com/go/team

chief architect, tapestry cms  http://products.turnkey.to

onTap is open source           http://www.turnkey.to/ontap


> You can't have the pound signs in the isDefined function -
> since it's in quotes, CF assumes you mean the pound sign.

> Try this:

> <cfset authTest = "session.auth.#articleId#">
> <cfif isDefined("authTest")>
>   (do something)
> <cfelse>
>   (do something else)
> </cfif>



>>
>>
>>I have a variable in a struct called session.auth that is
>>related to the id
>>of the article the user is seeing.  If the variable
>>#session.auth.100824#
>>exists, the user can visit article 100824 otherwise he's
>>denied access.
>>
>>
>>
>>How can I check that this variable exists?   I have tried
>>the following and
>>it throws an error, saying that isdefined has to have a
>>syntactically valid
>>variable name:
>>
>>
>>
>>Where did I get it wrong please?
>>
>>
>>
>>Here's what I've put that throws an error:
>>
>>
>>
>><cfif isdefined("Session.auth[#articleid#]")>
>>
>>you're in
>>
>><cfelse>
>>
>>you're out
>>
>></cfif>
>>
>>
>>
>>
>>
>>
>>
>>Cheers,
>>
>>Michael Kear
>>
>>Windsor, NSW, Australia
>>
>>AFP Webworks.
>>
>>
>>
>>
>>
>>
>>
>>
>>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~|
> ColdFusion MX 6.1, now 2.5 times faster.
> http://www.macromedia.com/software/coldfusion/productinfo/
> upgrade/jump/introducing.html?trackingid=ColdFusion_468x60
> g_HouseofFusion_carat_082803

> Message:
> http://www.houseoffusion.com/lists.cfm?link=i:4:138782
> Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
> Subscription:
> http://www.houseoffusion.com/lists.cfm?link=s:4
> Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubsc
> ribe.cfm?user=633.558.4



[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to