Actually tell me to shut up..
I missed the IsDefined you had there...
[EMAIL PROTECTED]
sign.co.uk To: <[EMAIL PROTECTED]>
cc:
13/04/2004 15:16 Subject: RE: [ cf-dev ]
Session Variables
Please respond to dev
The code that gets run at the beginning of each page... the values not
persisting is probably because each time you do
<cfset session.formresult = Structnew()>
which will create a new, empty struct, not containing any of your old
values.
James Constable
AlienationDesign
[EMAIL PROTECTED]
sign.co.uk To:
<[EMAIL PROTECTED]>
cc:
13/04/2004 15:00 Subject: RE: [
cf-dev ] Session Variables
Please respond to dev
when you say "This is a template that runs at the beginning of each page" -
I assumed you meant this code was in your application.cfm, which is 'a
template that runs at the beginning of each page'. Or are you actually
calling a template seperately from the individual pages each time? If so,
could you just transfer the code to application.cfm instead?
How about putting some output into the code that creates the session
variables, so you can see each time it is called. Ideally, this If
statement should only execute once - before (or after?) submitting the
first form. Thereafter, the session variables should already exist, so it
needn't be called again. Stick some output code in that if statement to
see each time it is being executed though.
"Sam Westlake"
<[EMAIL PROTECTED]> To:
<[EMAIL PROTECTED]>
cc:
13/04/2004 14:51 Subject: RE: [
Please respond to dev cf-dev ] Session Variables
yep, cookies are turned on.
still getting the same problems though - I have debugged the template that
instantiaites the structure collection and that is ONLY getting called the
first time through.
Definately not a time-out problem.
I have changed the locking to "SESSION" and encapsulated all the code that
accesses the SESSION scope in locks.
No improvements. I didn't put the sub-structures at the SESSION level (at
the moment they all sit a structure in the Session scope), because I don't
understand why this will help - but I'll try it next.
Will enabling J2ee Sessions help in anyway. I am new to sessions in CF.
Sam
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: 13 April 2004 14:39
To: [EMAIL PROTECTED]
Subject: Re: [ cf-dev ] Session Variables
also, do you have session cookies enabled in your browser?
"Sam Westlake"
<[EMAIL PROTECTED]> To:
<[EMAIL PROTECTED]>
cc:
13/04/2004 14:04 Subject: [ cf-dev
Please respond to dev ] Session Variables
I am trying to persist session variables from one page to the next.
This is the application.cfm file:
<cfapplication name="game001"
clientmanagement="Yes"
sessionmanagement="Yes"
sessiontimeout="#CreateTimeSpan(0,0,10,0)#"
applicationtimeout="#CreateTimeSpan(0,0,10,0)#">
This is a template that runs at the beginning of each page (six pages - one
for each formResult structure) to instatiate empty structure objects in the
session scope:
<cfif isDefined("session.formResult") IS FALSE>
<!--- lock the session variable to stop race conditions --->
<cflock name="game#SESSION.SessionID#"
type="exclusive"
timeout="3">
<!--- instantite empty structures for each section --->
<cfset session.formResult = StructNew()>
<cfset session.formResult.planning = StructNew()>
<cfset session.formResult.buying = StructNew()>
<cfset session.formResult.preparing = StructNew()>
<cfset session.formResult.marketing = StructNew()>
<cfset session.formResult.tenants = StructNew()>
<cfset session.formResult.selling = StructNew()>
</cflock>
</cfif>
This is a template that runs after every form submission ("type" is a
hidden field in the form and has a value of one of the above structures,
e.g., planning, buying, preparing, etc) - it copies the form results to the
appropriate structure
<cfif isDefined("FORM.type")>
<cfset session.formResult["#FORM.type#"] = FORM>
</cfif>
After running this last template then I cfdump the session scope. Each time
it shows the form elements from the current form submission succesfully
added to the appropriate structure in the session scope. But after
submitting the next form then any form variables from the previous
submission are not found - only the empty structure and the current
variables each time
Anyone know why this is happening?
Thanks in advance,
Sam Westlake
--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]
--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by
activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]