The Action Page

Team-Fly    

ColdFusion® MX: From Static to Dynamic in 10 Steps
By Barry Moore
Table of Contents
Step 5.  Using Forms with ColdFusion MX


The action page is a ColdFusion template that receives the information passed by the form. This template also contains code to process the information it receives. The following are some of things you can do with action pages:

  • Display confirmation of submitted information

  • Mail information to an individual or mailing list

  • Query a database based on form input

  • Edit or insert information into a database

Our DemoAction1.cfm template will simply display confirmation information to the user who submitted a form. All of the information posted to the action page will be posted as variables. These variables are available in the FORM scope, and the variable names are determined on the form page by the NAME attribute of the individual form fields. For example, the following line of code from our DemoForm1.htm page creates a text input box to gather information. It will store that information in a FORM variable named Email.

 <INPUT TYPE="Text" NAME="Email" SIZE="30">

The action page will then be able to access the value stored in this variable by using the FORM.Email variable name. Listing 5.2 shows the code required for the action page to display a confirmation message to the user who submitted the form. Figure 5.2 shows the action page displayed in the browser.

Figure 5.2. The action page browser display.

graphics/05fig02.gif

Listing 5.2 ColdFusion Action Page, DemoAction1.cfm
 <HTML>    <HEAD>        <TITLE>Demo Action Page</TITLE>    </HEAD>    <BODY>        <CFOUTPUT>              <H2>#FORM.Name#, Thank You For Your Feedback</H2>              You Submitted<BR>              <HR WIDTH="50%" ALIGN="left">              <B>Name: </B>#FORM.Name#<BR>              <B>Email: </B>#FORM.Email#<BR>              <B>Comments:</B><BR>              #FORM.Comments#        </CFOUTPUT>    </BODY>  </HTML>

    Team-Fly    
    Top
     



    ColdFusion MX. From Static to Dynamic in 10 Steps
    ColdFusion MX: From Static to Dynamic in 10 Steps
    ISBN: 0735712964
    EAN: 2147483647
    Year: 2002
    Pages: 140
    Authors: Barry Moore

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net