EasyCFM.COM ColdFusion Forums / Coding Help! / 3 page form

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: 3 page form -- page: 1 2

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

jazzer
02-08-2005 @ 3:16 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 9
Joined: Mar 2004

This has got to be an easy question - how do I pass an item from the first page of a form into the second and third pages?

I'm making an app that is like an e-card. You choose a graphic and type in text, preview the card, then email it. I can get it all to work fine if I do the preview and email in one action page. But when I try to seperate the preview and then click through to a third page to email I lose the results from the first page.

Do I use hidden fields? Or cfset to define a variable?

GrowlyBear
02-08-2005 @ 3:23 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1314
Joined: May 2004

Actually we need more info from you.
sample code...


~~~~~~~~~~~~~~~~~~~
There is no place like 127.0.0.1

JJfutbol
02-08-2005 @ 3:34 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1250
Joined: Nov 2004

Well you could use hidden fields but you would have to continously pass it between each form and you know what that sounds real REAL icky! So we'll stick with a much much better answer to this problem: Session variables.

Store all your form vars once the user hits submit on each of the 3 forms in Session variables. But first as my good fruity friend GrowlyBear (what a terrible name lol) says please show us some sample code. Also my big question for this that would make using Session variables key is do you provide the user with a Back button from each of the forms?? If so Session vars are definetly the way to go.

We will come... We will play... We will conquer... We are Laziales!!... Fear us.

jazzer
02-08-2005 @ 3:37 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 9
Joined: Mar 2004

OK, and Thanks,

Here is the second page, the first is a form that displays the input choices:

<form action="mail.cfm" method="post">
<cfoutput>
   <p>Here is your electronic Thank You card: </p>
   <p><img src="#form.card#"> </p>
   <p>#form.name#</p>  
   <p><#form.message#</p>
</cfoutput>
<input type="submit" value="Email my Card">
</form>

This page works fine for displaying the results, but it doesn't work for the email action page:

<CFMAIL TO="sjed@osc.state.us"
FROM="test@osc.state.us"
Subject="E Card"
TYPE="HTML">

<img src="http://webntinter3/ecard/#form.card#"><br>

#form.message#

</cfmail>

Note: this email code works fine in the second page to mail the results.


maquiladoras
02-08-2005 @ 3:58 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 2073
Joined: Dec 2002

i think it'd be far easier just to do

<form action="mail.cfm" method="post">
<cfoutput>
   <p>Here is your electronic Thank You card: </p>
   <p><img src="#form.card#"> </p>
   <p>#form.name#</p>  
   <p><#form.message#</p>
<input type="hidden" name="card" value="#form.card#">
<input type="hidden" name="name" value="#form.name#">
<input type="hidden" name="message" value="#form.message#">
</cfoutput>
<input type="submit" value="Email my Card">
</form>


no point wasting resources on session vars for something that simple


-
"There is no justice, There is Just Us"
-

jazzer
02-08-2005 @ 4:03 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 9
Joined: Mar 2004

That's pretty much what I'm doing, but my email is coming back with:

#form.message#

instead of processing the value.

Here's my email page:

<CFMAIL TO="sjed@osc.state.us"
FROM="test@osc.state.us"
Subject="E Card"
TYPE="HTML">

#form.message#

</cfmail>

GrowlyBear
02-08-2005 @ 4:07 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1314
Joined: May 2004

Looks like you have to put cfoutput around it

<CFMAIL TO="sjed@osc.state.us"
FROM="test@osc.state.us"
Subject="E Card"
TYPE="HTML">
<cfoutput>
#form.message#
</cfoutput>
</cfmail>

~~~~~~~~~~~~~~~~~~~
There is no place like 127.0.0.1

jazzer
02-08-2005 @ 4:10 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 9
Joined: Mar 2004

Error Diagnostic Information
Invalid tag nesting configuration

A CFOUTPUT tag is nested inside a CFMAIL tag with no GROUP= or QUERY= attributes . This is not allowed.


GrowlyBear
02-08-2005 @ 4:16 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1314
Joined: May 2004

your right, in my own cfmail I do not use cfoutput.
sorry should have checked my own app first.

So is the email page that has the cfmail reveiving the info via a form? From your post you seem to have hardcoded your email into the cfmail so that will work.
The form.message has to sent to the cfmail page via a form submit. unless you are using a session variable.

~~~~~~~~~~~~~~~~~~~
There is no place like 127.0.0.1

JJfutbol
02-08-2005 @ 4:27 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1250
Joined: Nov 2004

maquiladoras, watch it son! lol Thats my word, shame on you for taking my line. Frown  lol A good laugh, moving on, you won't need a cfoutput when using cfmail. Well I've never used one as it always works just fine. Its just like a cfquery tag. If you use CF Vars in there you don't need a cfoutput. I guess we can say cfouput is mainly for outputting CF vars on a page only?? Correct me if I'm wrong but I do know jazzer that you shouldn't need a cfoutput in your CFMAIL tag, its always worked just fine for me. Let us know what you find out.

We will come... We will play... We will conquer... We are Laziales!!... Fear us.

PAGE: 1 2
Sponsored By...
iOpenSoft, LLC is a Houston, Texas Advanced Technology Studio Specializing in Web Design, Web Development, iPhone App Development and Android App Development.