Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / October 2004



Tip: Looking for answers? Try searching our database.

Session Problems - changing variables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tphethean - 27 Oct 2004 12:35 GMT
Hi, beginner here, so bear with me if i sound confused!

I'm trying to store the variables of a form in session variables, and am
having trouble changing the variables.  At the moment, the process is a follows:

1)User Logs in and starts completing form, default session variables assigned:
<cflock timeout=20 scope="Session" type="Exclusive">
    <cfparam name="SESSION.fname" default="default">
    <cfparam name="SESSION.lname" default="default">
</cflock>

2)User submits form, which updates session variables to the values in the form
<cfloop list="#form.fieldnames#" index="i">
        <cfoutput>
        <cflock timeout=20 scope="Session" type="Exclusive">
            <cfset SESSION.i = #evaluate("form.#i#")#>
        </cflock>
        </cfoutput>
</cfloop>

However, when i then try to check the contents of the session variables after
the form has been submitted, the contents of the session is still the same as
set in the default.

Session management is turned on in the application.cfm, and in the CF
Administrator. I'm running out of ideas now...

Any help would be brilliant.

Thanks.
Tom
cgsj_usa@yahoo.com - 27 Oct 2004 13:58 GMT
How about changing this?

<cfset session.i = #evaluate("form.#i#")#>

to

<cfset #evaluate(session.i)# = #evaluate(form.i)# />

If that doesn't work, surround the "i"'s by pound signals.

Hopefully, that does the trick.  Thanks!

Chris
tphethean - 27 Oct 2004 14:25 GMT
If i try  <cfset #evaluate(session.i)# = #evaluate(form.i)# /> I get the error
: "Can not assign a value to a function.  
Unable to assign a value to the function "evaluate" on line 9, column 33  "

If i then encapsulate the "i"'s  with pound signs i get :  "A CFML variable
name cannot end with a &quot;.&quot; character.  
The variable session. ends with a "." character. You must supply an additional
structure key or delete the "." character. "

Thanks for help so far, any more would be great.
NateNielsen - 27 Oct 2004 15:02 GMT
you'll want this  :

<cfset "session.#i#" = evaluate("form.#i#")>

Have fun!   =)

Nate Nielsen
http://www.webclarity.com
xmldb component - create xml file based tables/datasources!  (free & open
source)
tphethean - 27 Oct 2004 15:50 GMT
Thanks a lot for your help, works a treat :)

Now the fun starts!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.