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.
>
>
>
>
>
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
- What's wrong with this... Cutter (CF-Talk)
- Re: What's wrong with this... Jim McAtee
- RE: What's wrong with this... Mike Brunt
- Re: What's wrong with this... Calvin Ward
- Data Sources? C. Hatton Humphrey
- Re: Data Sources? Paul Hastings
- How can i test for this? Mike Kear
- RE: How can i test for this? lee
- RE: How can i test for this? Philip Arnold