ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old February 7th, 2004, 05:54 AM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How to save form data to be recalled at a later date

I have an app written in fusebox 3, and all is working well. I would, however, like to break the part where users register down into smaller fuses.

Scenario - currently, users submit form info which is then checked against a database to make sure the 'team_name' field is unique. If it is not, they are redirected to submit new info, otherwise it is written to a database. At the moment I use an exit fuseaction to redirect to the URL if the form entries fail. I would like to do the same for a successful registration - an exit fuseaction that then uses a query to write their form info to a database and emails the administrator. However, when I try this, cold fusion cannot remember the previous form entries, and thus chokes.

My question: Is there any way to save the form info as a variable to be recalled when that fuseaction is triggered?

All help greatly appreciated
TIA
Mark

Here is my current code, which works fine..
===============================

<cfquery datasource="#request.dsn#" name="teamInfo">
SELECT team_name
FROM client
WHERE team_name = '#form.team_name#'
</cfquery>

<cfif teamInfo.recordcount>
<cflocation URL="#self#?fuseaction=#XFA.failedRegister#">

<cfelse>
<!--- ideally, this is where I would like to insert the fuseaction called #XFA.addRegisterInfo# --->
<!--- insert new record --->
<cfquery datasource="#request.dsn#" name="register">

INSERT INTO client (
team_name, username, password, company_name, address_1, address_2, phone, email
)

VALUES (
'#trim(form.team_name)#',
'#trim(form.username)#',
'#trim(form.password)#',
'#trim(form.company_name)#',
'#trim(form.address_1)#',
'#trim(form.address_2)#',
'#trim(form.phone)#',
'#trim(form.email)#'
)
</cfquery>

<cfmail
from="admin@gorebiz.co.nz"
to="email address go here"
subject="Super 12 Registration">
A new team has just signed up for the Super 12 2004 Tipping Competition. Details are as follows:

Team Name: #form.team_name#
Address 1: #form.address_1#
Address 2: #form.address_2#
Contact Phone: #form.phone#
Contact Email: #form.email#
</cfmail>

<cflocation URL="#self#?fuseaction=#XFA.successfulRegister#">

</cfif>

Reply With Quote
  #2  
Old February 7th, 2004, 12:13 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,480 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 33 m 17 sec
Reputation Power: 42
There are a few options. You could use cfmodule to recursively call the application and run the desired fuseaction, passing in the form structure as an attribute. This may be difficult depending on how you have your application structured.

You could save the form struct as a session variable so that it is available in the next fuseaction.

Another option is to serialize the form struct into a WDDX XML string using <cfwddx> and store it in a database or as a client variable. On the next fuseaction you'd have to deserialize the XML back into a CFML structure.

For the future, you might consider looking at Fusebox 4. Since you can easily call multiple fuseactions from within the controller XML, it makes things like this very easy. No need to copy the variables around, use <cfmodule>, or even use <cflocation>.

Reply With Quote
  #3  
Old February 7th, 2004, 12:40 PM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes fusebox 4 is the next step, but not right now. A session variable seems the most apropriate at this stage. So how would I go about doing this?

Reply With Quote
  #4  
Old February 8th, 2004, 02:31 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,480 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 33 m 17 sec
Reputation Power: 42
Copy the form structure to a session variable:
<cfset session.formStruct = form />

and then on the next page, copy it back to the form scope:
<cfset form = session.formStruct />

Don't forget to lock your session reads and writes if a race condition is possible. And you may also want to purge the data from the session scope after you copy the structure back to the form scope. You can do this with structDelete().

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > How to save form data to be recalled at a later date


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway