The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> ColdFusion Development
|
Data persistance in Cold Fusion
Discuss Data persistance in Cold Fusion in the ColdFusion Development forum on Dev Shed. Data persistance in Cold Fusion ColdFusion Development forum discussing CFML coding practices, tips on CFML, and other CFML related topics. Find out why ColdFusion is the tool of choice for many e-commerce developers.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

August 14th, 2003, 10:52 AM
|
|
Registered User
|
|
Join Date: Aug 2003
Location: Baltimore, MD
Posts: 12
Time spent in forums: 1 h 16 m 23 sec
Reputation Power: 0
|
|
Data persistance in Cold Fusion
I have 5 pages taking employee information as input (Personal data, Education, Working Exp, Projects, Skills etc) I am using javascript for client side validation and Cold Fusion on the server side. I want to persist data from first to last form so that at end of submission user can verify the data from all 5 pages , then it will be posted in the data base. Please help!!! Thanks 
|

August 14th, 2003, 03:01 PM
|
 |
Moderator Emeritus
|
|
Join Date: Feb 2002
Location: Scottsdale, AZ
|
|
|
You could write the filled-out data to <input type=hidden> tags on each subsequent page of the form... that way, all of the data stays until you're ready to submit to the DB.
Alternately, you could write the data to the database in sections, but you would need to determine which user was writing to which part of the DB as you went along. I'm sure CFML has a 'session' ID similar to that of PHP that you could use to link the 2 for this purpose.
|

August 14th, 2003, 03:17 PM
|
|
Registered User
|
|
Join Date: Aug 2003
Location: Baltimore, MD
Posts: 12
Time spent in forums: 1 h 16 m 23 sec
Reputation Power: 0
|
|
|
Code
<input type=hidden> tag is not an option here since I have about 100 questions and 5 pages to post. I was thinking about using session variables, but never built anything using session variable from scratch. SO if someone can send me a code example on how to use session variable I would appretiate it!
Thanks
|

August 14th, 2003, 06:44 PM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
Using session variables in CF is absurdly easy.
First, make sure you put a <cfapplication> somewhere that will run on each request, most likely the Application.cfm file. Something like this:
<cfapplication name="myAppName" sessionmanagement="Yes">
Then, when you want to set a session variable, you do:
<cfset session.myVar = "whatever">
To read it, you do:
#session.myVar#
That's it.
The only other thing to note is that if you plan on a decent load on the server, you should use <cflock> to lock reads and writes to session variables. Since they are memory-resident, you must avoid memory contention by locking if you expect a heavier load. But this is not required (it is recommended though).
Example:
<cflock timeout="" throwontimeout="No" name="#createUUID()#" type="EXCLUSIVE">
<cfset session.myVar = "whatever">
</cflock>
<cflock timeout="" throwontimeout="No" name="#createUUID()#" type="READONLY">
<cfset someLocalVar = session.myVar>
</cflock>
A well thought out application will minimize the need for locking by locking once at the start of the request to copy the session vars into the local scope, and then at the end of the request copy them back into the session scope.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|