Thanks... this code worked with a little modification... since I was lopping
over the "fieldnames" variable.. .I had to remove the "Form." & from the
evaluate parameters... :)
I normally use form or url variables for passing information between
forms... however the form I am working with has more than a handful of
fields so I thought I would use session variables for holding the submitted
form field data and re-populating the form if there is an error or omission
in the form... I have used them before just setting them with hard coded
single <cfset> statements for each form variable... so, I decided to do
something with looping over the fieldnames...
I am always willing to learn a new method though... how would handle
re-populating a form with values after it was submitted... if someone
entered data that did not meet the validation rules processed after the
submission... I do basic JavaScript for fields requiring a value.
thanks
Jay
-----Original Message-----
From: Bryan Love [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 16, 2001 5:13 PM
To: CF-Talk
Subject: RE: form to session
Why you would want to convert innocent, safe form fields into tricky,
unstable session variables is beyond me, but here's the code...
<cfloop list="#form.fieldnames#" index="i">
<cfset "session.#i#" = evaluate("form." & i)>
</cfloop>
Bryan Love ACP
Internet Application Developer
[EMAIL PROTECTED]
-----Original Message-----
From: Jay Wigginton [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 16, 2001 1:35 PM
To: CF-Talk
Subject: form to session
Is there a simple way to take the values submitted from a form and setting
session variables with the same name... example:
form submits variables.... Form.FirstName and Form.LastName... I need to
set... Session.FirstName = Form.FirstName and Session.LastName =
Form.LastName...
I know I can use... <cfset Session.FirstName = Form.FirstName>
But, I want to do this <cfloop> looping over the fieldnames... something
like...
<cfloop index="field" list="#fieldnames#">
<cfoutput>
<cfset session.#field# = Form.#field#>
</cfoutput>
</cfloop>
The above produces an error... :(
thanks in advance
Jay
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists