Stephen,

I am not going to comment on the client vs. session variable issue that
everyone else is talking about.  I am awfully ignorant about client
variables, and I am learning from those other messages as they come.

I can, however, offer some advice on the approach to a multi-page form with
session variables.  I just (last night) released a multi-page registration
system for a web site.  When I started, I thought, "I'll just put the
variables from each form submission into a session variable, which I will
store until the end of the process, at which point everything will be
submitted at once."  OK.  That made sense, but with locking and keeping
track of things and needing to let the user go back and forth and edit data,
things got miserable from a variable management standpoint.  Halfway
through, although I kept the basic concept the same, I made a change which
greatly simplified my life.

Here's the idea: the biggest heartaches came in testing for a variable's
existence, providing for all possible cases of its value, and the locking
issues.  So, I eliminated all of them.  I created a page called
registration_init.cfm that set to default values all of the session
variables that I would be using throughout the registration process.  At the
top of each page, I have one CFLOCK block that pulls all of the relevant
session variables for the form into local variables.  Each page then
pre-populates its form fields with those local variables, regardless of
their value; if they are blank, fine, and if they have data from the session
variables, fine.  This allows you to go back and forth between forms very
easily.  I also set up my pages in a (probably inefficient) funny way.  The
flow is like this:

registration_init.cfm
registration1.cfm
registration1_action.cfm
registration2cfm
registration2_action.cfm
etc.

Each "action" page validates all of the data and goes to the appropriate
page: forward if everything is okay, and back if it's not.  If it goes back,
it also passes error values which appear on the page to let the user know
what they did wrong and how to fix it.  I can't remember right now if this
flow setup tied into the session variable management issue, but just so you
have some more ideas, I thought I'd throw it in.

Anyhow, the main thing is that by pre-defining all the variables that I was
going to use, I removed the need to check their values on each page.  Of
course, it's essentially doing the same thing, but by doing it in a
centralized way was a lot easier.

Hope this rambling is helpful,
Matthieu
-----Original Message-----
From: Adams, Stephen [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 9:30 AM
To: CF-Talk
Subject: RE: Finding a good Session management system.


**********************************************************************
WESTMINSTER CITY COUNCIL
Please refer to the disclaimer beneath this message
**********************************************************************

Well, the application I am building at the moment uses a series of forms to
gather information from the user and then on the final page runs a query
based on what has been selected in these forms.  So I am storing some of the
user's choices in session variables so that they can be passed can be used
in the query on the last page.  This is quiet a small application.  My next
one is going to be a large intranet with a lot of personalisation.

Oh I love web-rat.com by the way, great site.

Stephen


> ----------
> From:         [EMAIL PROTECTED][SMTP:[EMAIL PROTECTED]]
> Sent:         22 July 2002 14:10
> To:   CF-Talk
> Subject:      RE: Finding a good Session management system.
> 
> That was a pretty vague and not very helpful answer John.
> 
> Stephen, what all are you storing in session variables?  Could you 
> describe your application a little more?  I've always tried to make sure 
> that I'm using session variables as little as possible anymore.  I've 
> moved majority of my session variables into client variables (storage in 
> db).  None the less, there's still a variable management issue that you 
> have to get your fingers wrapped around.  Perhaps you're storing too much 
> information into the session scope if you're pondering that there has to 
> be a better way.
> 
> So.. my advice to you is to do a <cfdump var="#session#"> (proper locks 
> around of course) and take a good hard look at what really should / 
> shouldn't be there.
> 
> ~Todd
> 
> On Mon, 22 Jul 2002, John McCosker wrote:
> 
> > Don't use session variables,
> > but use cookies which maintain session state when the browser is open
> > and deleted when closed.
> > 
> > -----Original Message-----
> > From: Adams, Stephen [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, July 22, 2002 1:54 PM
> > To: CF-Talk
> > Subject: Finding a good Session management system.
> > 
> > 
> > **********************************************************************
> > WESTMINSTER CITY COUNCIL
> > Please refer to the disclaimer beneath this message
> > **********************************************************************
> > 
> > Hi,
> > 
> > I have been building CF sites for a while now and I am always finding
> myself
> > creating/deleting and checking for session variables or changing them
> into
> > request variables.  It always seems to me that there must be a better
> way in
> > which to use them.  A way that lets me create them easily, delete them,
> keep
> > track of them with out have to write tons of code and does not add loads
> of
> > time to the running of my applications..
> > Does anyone know of or have any tips on how I can easily handle the
> > management of session variables.
> > 
> > Thanks 
> > 
> > Stephen
> > 
> > 
> > **********************************************************************
> > Westminster City Council switchboard: 
> > +44 20 7641 6000
> > **********************************************************************
> > This E-Mail may contain information which is 
> > privileged, confidential and protected from 
> > disclosure.  If you are not the intended recipient 
> > of this E-mail or any part of it, please telephone 
> > Westminster City Council immediately on receipt.
> > You should not disclose the contents to any other 
> > person or take copies.
> > **********************************************************************
> > 
> > 
> > 
> 

______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to