You sure the line number in the error is pointing you to this block of code?
I see nothing wrong with:
<cfif structKeyExists(session,'user')>
<cfif isDefined("session.user.displayname")>
<p class="toptext">
Logged In: <cfoutput>#session.user.displayname#</cfoutput>
<input type="button" class="logout" value="Logout" onClick="location.href =
'index.cfm?event=home.logout'">
</p>
</cfif>
</cfif>
Or even...
<cfif isDefined("session.user.displayname")>
<p class="toptext">
Logged In: <cfoutput>#session.user.displayname#</cfoutput>
<input type="button" class="logout" value="Logout" onClick="location.href =
'index.cfm?event=home.logout'">
</p>
</cfif>
They both work as you would expect with or without the variable set.
-----Original Message-----
From: Buntin, Seth - KATE [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 31, 2005 1:22 PM
To: CF-Talk
Subject: Session variable error
I have this:
<cfif structKeyExists(session,'user')>
<cfif isDefined("session.user.displayname")>
<p class="toptext">
Logged In:
<cfoutput>#session.user.displayname#</cfoutput> <input type="button"
class="logout" value="Logout" onClick="location.href =
'index.cfm?event=home.logout'">
</p>
</cfif>
</cfif>
I would assume that is the session.user.displayname isn't defined it
would worry about giving an error but I get:
Element USER.DISPLAYNAME is undefined in SESSION.
Why is that?
Seth Buntin
Web Resources Coordinator
Kentucky Academy of Technology Education
Murray State University
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217039
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54