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.