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
 
Unread Dev Shed Forums Sponsor:
Dell PowerEdge Servers
  #1  
Old March 3rd, 2004, 04:52 PM
kdiff kdiff is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 15 kdiff User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
Simple transfer of data from form to form

I would like to create a basic form that passes form data from one to the next and so on until I end it with a CFmail to. I am new to coding and know this is a very basic one.

Also, anyone have any good books to reference on beginners in CF coding?

Thanks,

kdiff

Reply With Quote
  #2  
Old March 3rd, 2004, 06:16 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
When you post a form to another CF page, the form data is available to the target page in the FORM scope. So if your form has a field called "firstName" and you post that form to another CF page, you can reference that data as "form.firstName". For example, to output it:

<cfoutput>
#form.firstName#
</cfoutput>

There are many good CF books, but the "bible" is Ben Forta's book.

Reply With Quote
  #3  
Old March 3rd, 2004, 06:22 PM
kdiff kdiff is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 15 kdiff User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
What if I want multiple pages

Everything you said makes sense. I will try it. If I want to transfer data from my first from page to the third would I just put the CF output on the second page as well? Basically does that continue from one page to another?

Thanks for all your help!

Reply With Quote
  #4  
Old March 3rd, 2004, 08:08 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
Well, if you transfer from the first page to the third page, doesn't the third page become the "second page"? Each web request is stateless and self-contained. You could post the form to one of any number of different ColdFusion templates and the FORM scoped data would be available on whichever one you posted to. If you copied the data in the FORM scope into form fields on the target page, and then posted THAT form to yet another page, the values would carry over. In other words, you have to take responsibility for moving the variables from page to page either manually or by looping over the data in the FORM scope and dynamically creating form fields.

Another option is to use the SESSION scope, which is a persistent, memory-resident scope that is independent of individual page requests. But I would read through Forta's book or a similar overview before attempting too much more.

Reply With Quote
  #5  
Old March 3rd, 2004, 08:35 PM
kdiff kdiff is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 15 kdiff User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
Reply to Kiteless

I guess I should have described what I was saying a little better. I was asking if I had 3 pages and I wanted to take the data from page 1 to page 2 and then the data from page one and 2 to page 3 could I do that in the same way you described previously?

Also, could you give me the exact name of that book by ben forta? I did a search for it in Amazon and did not see a "cold fusion bible"

Thanks,

-kdiff

Last edited by kdiff : March 3rd, 2004 at 08:47 PM. Reason: One more thought...

Reply With Quote
  #6  
Old March 4th, 2004, 10:32 AM
stpaz stpaz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 17 stpaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 51 sec
Reputation Power: 0
construction kit

what you might be trying to do is something like this

place this within your form and it should pass you previously submitted fields to the subsequently submitted pages

The <cfset ListDontDuplicate = "Submit"> part is so that you can remove the submit button form the forwarded list

<cfparam name="form.FIELDNAMES" default="">
<cfset ListDontDuplicate = "Submit">
<cfloop list="#form.FIELDNAMES#" index="i">
<cfif listfind(ListDontDuplicate,i) eq 0>
<cfoutput><input type="Hidden" name="#i#" value="#evaluate('form.'&i)#"></cfoutput>
</cfif>
</cfloop>

Reply With Quote
  #7  
Old March 4th, 2004, 02:58 PM
kdiff kdiff is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 15 kdiff User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
Closer but not working

Ok Here are my three pages. How do people normally do multipage questionaires? In any case here is my code. You will be able to see just how much I know (which is not much) but I do have a desire to learn and will be buying that book.

Page 1
<body>
<form name="form1" method="post" action="form2.cfm">
<p>
<input name="email" type="text" id="email">
</p>
<p>
<input name="Next" type="submit" id="Next" value="next">
</p>



</form>

</body>

Page 2

<body>
<form name="form2" method="post" action="form_send.cfm">
<p><cfparam name="form.email" default="">
<cfset ListDontDuplicate = "Submit">
<cfloop list="#form.email#" index="i">
<cfif listfind(ListDontDuplicate,i) eq 0>
<cfoutput><input type="Hidden" name="##" value="#evaluate('form.'&i)#"></cfoutput>
</cfif>
</cfloop>
<input name="box1" type="text" id="box1">
</p>
<p>
<input name="Next" type="submit" id="Next" value="next">
</p>
</form>

</body>

Page 3

<p><font size="3">Thank you for your message. If necessary we will
respond in a timely manner.</font><!--- END Body --->

<cfparam name="email" default="">
<cfparam name="box1" default="">
<cfmail to="test@test.com"
from="#email#"
subject="maintenance request form"
type="html">

<tr>
<td valign="top"><font face="arial,helvetica" size="-1"><b>email:</b></td>
<td valign="top"><font face="arial,helvetica" size="-1">#email#</td>
</tr>
<tr>
<td valign="top"><font face="arial,helvetica" size="-1"><b>box1:</b></td>
<td valign="top"><font face="arial,helvetica" size="-1">#box1#</td>
</tr>
</table>
</cfmail>

What do you think?

Reply With Quote
  #8  
Old March 4th, 2004, 05:34 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
On page 2, this:

<cfloop list="#form.email#" index="i">

Should be:
<cfloop list="#form.FIELDNAMES#" index="i">

And this:
<cfoutput><input type="Hidden" name="##" value="#evaluate('form.'&i)#"></cfoutput>

Should be this (note that you don't need to use evaluate here as stpaz suggested...avoid using evaluate() if at all possible):

<cfoutput><input type="Hidden" name="#i#" value="#form[i]#"></cfoutput>

Other than that, I don't see any other problems upon a quick overview.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Simple transfer of data from form to form


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 5 hosted by Hostway