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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 15th, 2004, 12:46 PM
liam.omalley liam.omalley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 4 liam.omalley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 47 sec
Reputation Power: 0
cfmail and HTML interaction

Hello,

I am trying to include a script in my form page which will send both the form information (in HTML inputs) to me, as well a confirmation email to the person who has filled out the form (designated as #form.email#). I am pretty new to coldfusion, so I am not all that familiar with syntax issues and interaction with html form tags and such. First I tried using the cf function in a separate file, which had as the code:

<cfmail
from= #form.email#
to="omalleyl@staff.abanet.org"
subject="Live from SEC 2004 Registration"
server="192.168.2.201">

Name : #form.name#
Firm : #form.firm#
Address : #form.address#
City : #form.city#
State : #form.state#
Province : #form.province#
Zip Code : #form.zip_code#
Country : #form.country#
Phone : #form.phone#
Fax : #form.fax#
Email : #form.email#
Registration Category : #form.register#
Video Site Request : #form.alternative_video#
Telephone Site Request : #form.alternative_tele#
Law School Site Request : #form.lawschool_site#
Video Quantity (member) : #form.videotape_quantity_member#
Video Quantity (nonmember) : #form.videotape_quantity_nonmember#
Section Membership : #form.membership#
Credit Card Type : #form.card_type#
Card Number : #form.cc_num#
Expiration Date : #form.exp_date#

</cfmail>

<cflocation url="http://www.abanet.org/intlaw/thanks.html">

while the application page simply called it by

<cfinclude template="livefromsec04.cfm">

<form name="regform" action="livefromsec04.cfm" method="post">

the errors that I got were that the application page could not find the .cfm file, and also that the field #form.email# did not exist.

It would suffice simply to write the function in the head of the page with the application, and call the function when the form is submitted, but I don't know the syntax for this.

<form name="regform" action="????" method="post">

So I guess what I am asking is how do you define the function in the head of the page, and how do you call it in the action of an html form tag?

Or any other simpler way to accomplish this would be great as well..

Thanks in advance for any help.

-Liam

Reply With Quote
  #2  
Old July 15th, 2004, 12:48 PM
liam.omalley liam.omalley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 4 liam.omalley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 47 sec
Reputation Power: 0
And yes, I have looked through the macromedia documentation on this.. but was unsuccessful in finding the problem.

Reply With Quote
  #3  
Old July 15th, 2004, 01:39 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 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 4 Days 10 h 8 m 55 sec
Reputation Power: 53
I think these are two separate issues. If CF is complaining that it can't find a .cfm file (which one can't it find by the way?), then that means that the target of an include, cfmodule, or some similar call is pointing to a file that CF can't find.

If CF is complaining that form.email does not exist, then either there is no form field in the posting form called "email", or you're not posting form variables to the target page at all. Make sure the "action" attribute of your form is pointing to your .cfm file that contains the cfmail code.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #4  
Old July 15th, 2004, 01:44 PM
adrapley adrapley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Washington DC, USA
Posts: 20 adrapley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'll try to explain this in a way that is not confusing to you.

You do not need to include the file 'livefromsec04.cfm' in the page that contains the form. It doesn't work this way in CF. CF is a server side language, and the form has to be submitted to an action page to send the email (not call the code as a function).

Also, for the 'server' attribute in your cfmail tag, make sure that it is a valid smtp server.


Try this

someForm.cfm

<form name="regform" action="livefromsec04.cfm" method="post">
<!--- Your form here --->
</form>


livefromsec04.cfm
<cfmail
from= #form.email#
to="omalleyl@staff.abanet.org"
subject="Live from SEC 2004 Registration"
server="192.168.2.201">

Name : #form.name#
Firm : #form.firm#
Address : #form.address#
City : #form.city#
State : #form.state#
Province : #form.province#
Zip Code : #form.zip_code#
Country : #form.country#
Phone : #form.phone#
Fax : #form.fax#
Email : #form.email#
Registration Category : #form.register#
Video Site Request : #form.alternative_video#
Telephone Site Request : #form.alternative_tele#
Law School Site Request : #form.lawschool_site#
Video Quantity (member) : #form.videotape_quantity_member#
Video Quantity (nonmember) : #form.videotape_quantity_nonmember#
Section Membership : #form.membership#
Credit Card Type : #form.card_type#
Card Number : #form.cc_num#
Expiration Date : #form.exp_date#

</cfmail>

<cflocation url="http://www.abanet.org/intlaw/thanks.html">

Reply With Quote
  #5  
Old July 16th, 2004, 10:47 AM
liam.omalley liam.omalley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 4 liam.omalley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 47 sec
Reputation Power: 0
Thanks for your replies.

I have tried all things suggested and still the element 'email' is undefined in 'form.'

Does it matter if it is an html input? Maybe it would work if I changed all my form elements to cfinputs? Is this necessary?
And if so... what about the form tag itself? Would cfform be preferable for any reason?

Thanks again for responding.

Reply With Quote
  #6  
Old July 16th, 2004, 11:13 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 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 4 Days 10 h 8 m 55 sec
Reputation Power: 53
No, using standard form elements vs. using cfform would make no difference. In fact, at runtime the CF engine replaces your cfform tags with standard form elements, it just adds some extra javascript validation, etc.

If you try to run the example code found in the documentation (http://livedocs.macromedia.com/cold...a.htm#wp2355015), does it work?

If that doesn't work, post or attach your form page and your cfmail page for us to look at.

Reply With Quote
  #7  
Old September 1st, 2004, 10:14 AM
peteboyd peteboyd is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Miami
Posts: 8 peteboyd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hidden Fields

You need to input some simiar hidden fields that correspond to the form fields that you are sending the the cfm script that is processing the form.

http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-pta.htm#wp2355015

<form action = "cfmail.cfm">
<pre>
TO: <input type = "Text" name = "MailTo">
FROM: <input type = "Text" name = "MailFrom">
SUBJECT: <input type = "Text" name = "Subject">
<hr>
MESSAGE BODY:
<textarea name ="body" cols="40" rows="5" wrap="virtual"></textarea>
</pre>
<!--- establish required fields --->
<input type = "hidden" name = "MailTo_required" value = "You must entera recipient">
<input type = "hidden" name = "MailFrom_required" value = "You mustenter a sender">
<input type = "hidden" name = "Subject_required" value = "You must entera subject">
<input type = "hidden" name = "Body_required" value = "You must entersome text">
<p><input type = "Submit" name = "">

</form>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > cfmail and HTML interaction


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


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





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