GotFusion.com Where your journey begins
Antons Video ProductionsNetObjects Fusion 7 Websites Portal

 


 

Step 4:    Create The Processing Page

  1. Create new page called cf-form-p which will be the processing/success page.  Place a text box on the page. In the text box enter the information that you want to give to your site visitor to let them know that the form has been sent. Something like "Thank you for taking the time to contact us. Someone will be in touch with you at the e-mail address you entered"
     

  2. Below you will see the form processing code which starts with the <cfmail> tag. You need to change the TO: email address in the processing code to your email address.  Copy the processing code to notepad.  Change "you@your_website.com" to YOUR actual email address and change the subject to what ever you wish to be your email subject.

    The code below is made up of 2 separate <cfmail> blocks and will process and send 2 emails (one to you and one to the person filling out the form). The first block which is inside of the <cfmail> tags is the one that is sent to YOU. The second one is a courtesy email that is sent to the person who filled out the form. If you Do not want to send this second email to the person who filled out the form just delete the second block of cfmail tags and only the form content will be sent to you. The end of each block is identified by the closing tag </cfmail>. ColdFusion is a tag based language just like HTML so you have opening and closing tags.

    The processing code that sends the form content to you:

    <cfmail
      from="#email#"
      to="you@your_website.com"
      subject="The Subject you wish to appear in the email sent to you"
    >
    Form information:

    Name: #name#
    email: #email#

    Comments: #comments#

    IP address: #remote_addr#
    Browser: #http_user_agent#

    #remote_host#
    #remote_user#
    </cfmail>



    The processing code that sends a courtesy email to the person filling out the form:

    <cfmail
      from="you@your_website.com"
      to="#email#"
      subject="Thank You for Contacting Us"
    >
    Dear #name#,

    Thank you for taking the time to contact the
    site webmaster with your comments.

    Sincerely
    Webmaster
    </cfmail>


  3. To give you an idea of what is happening above with the processing code: You have opening and closing ColdFusion tags. The opening tag contains the email creation information inside of it. Above it is broken down onto separate lines for easy readability but basically it is this tag:

    <cfmail from=" " to= " " subject=" ">.

    ColdFusion uses the # sign to identify veritable content (your input form information is the variable). Anything entered in the form can be used by ColdFusion just by wrapping the name you gave to the form field with # so if you wish to use the person's name in the email you would use the form field name (which in our example is name) and wrap it #name#. We are using what the visitor entered into the email field as the email address to send the email "to" by using #email# in the the to=#email# command.

    You can use any of the form input fields in the email body by using the form field "name" wrapped in # marks. The example above has a very basic email body. You can enter ANYTHING you wish into the email body and it will be written in the email EXACTLY as you use it in the processing code. The example email body above is:

    Form information:

    Name: #name#
    email: #email#

    Comments: #comments#

    Below that I have included some information that is collected by the web server such as the IP address of the visitor and what type of browser they were using. You DO NOT have to use this but you may find the information useful.

    The form processing code is finished with the closing tag

    </cfmail>


Insert the processing code in the processing/success page


Fusion version 11 and 12

Press F9 to bring up Layout Properties palette. Press the HTML button on the palette to bring up the page HTLM insert dialogue box and place your edited code in on the first line.



Fusion version 7.5 through 10

Press F9 to bring up Layout Properties palette. Press the HTML button on the palet to bring up the layout html insert palette and place your edited code in the Start of Page tab.



Fusion version 7 or earlier

You will need to press the HTML Source tab and insert this code on the VERY 1st LINE, then click Save when presented with the Save dialogue box


That is all that is needed to process forms to email using ColdFusion. You can make the comments in your email in any format you wish just as though you were creating an email with your email client and they will appear in the email that is sent exactly as you enter them with carriage returns and paragraph breaks exactly as you place them within the cfmail tag

Don't forget to set these two pages with a cfm extension by pressing F 11 then selecting the Custom Names button and entering cfm into the extension input box so that they will function.

Download a sample form processing page template for versions 8 and newer
(this template has form processing inserted in "Beginning of Body" tab for newer versions)

Look at another ColdFusion form to email processing tutorial written by Tami

Reference:

ColdFusion 8 Reference guide

View the PREVIOUS page

Return to the TOP of this page


|  Fusion  |  Web Design  |  Hosting  |  Resources  |  gotFusion Store  | 

Problems with this page?  

All content copyright © 2001 - 2005 gotFusion LLC. The name gotFusion and the gotFusion ® logo are registered trademarks of gotFusion LLC
Copyright, legal notice & privacy statement