Solved

CF - Multiple email form submit

Posted on 2011-03-15
6
325 Views
Last Modified: 2012-05-11
For some reason it has been requested that we have a email signup form that first comes up and asks for your email and after you click submit another form comes up asking for name, company etc.  How do I match up the first form submission with the second so the email submitted matches the name, company etc.

Any help is appreciated
0
Comment
Question by:JohnMac328
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 35141279

Do you want to create a database record for the first page or only after successful submission of both pages?

If saving after each page...
Have the first form submit, save, get the Primary key from the table and pass it to the 2nd form

If saving only after 2nd page...
Have the first form submit to the 2nd page, store those fields in hidden form fields, on submit, save everything


The first method is probably the one you want, it allows you to get some information saved before asking for more.  If the user bails out on the 2nd page, at least you have their basic info.  

0
 

Author Comment

by:JohnMac328
ID: 35141324
Yes - I was thinking of something like the first example.  How do I pass the primary key to the 2nd form?
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 35141378

The first form can post to the second form if you like.  At the top of the form-2's file, just test for the submit action of form-1.   You save the data and then drop down the code to show the 2nd form, putting the ID into a hidden field.

Alternatively, you can pass it on the URL,  After saving the first form, just do a cflocation

<cflocation url="form2.cfm?Id=#theID#" addToken="no">

0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

Author Comment

by:JohnMac328
ID: 35141416
So after the first submit the email will be added with the ID of 400.  With cflocation the remaining data will be entered also under the ID of 400?
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 35141494

 AFter the first submit, the email will be added (inserted, I assume?)
 Get the ID from the newly created record
 Pass the ID to the other form with CFLOCATION

 Now on 2nd form, ask for the information you want
 On submit, update the table using ID=#url.ID#


-------------------------------------------------------------------------
First Form..


  if submit then
     save email
     get ID
     cflocaton form2.cfm?ID=#getID#
  end if

 The Form (submit page to itself)
  What is your Email address [       ]
  [Submit button]




Second Form

  if submit then  
     update record where ID = #url.id#
     cflocation url="goSomewhereElse.cfm"
  end if

 
 The Form (submit page to itself)
   What is your name, phone, etc?
   [Submit button]
0
 

Author Closing Comment

by:JohnMac328
ID: 35141522
That should work.

Thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question