User Guide

Table Of Contents
Using forms in ColdFusion MX 611
Creating a basic form
The following simple form shows how you can create a form that lets a user enter data. This form
uses basic CFML form tags. It does not use any of the advanced features of ColdFusion MX, such
as validation, Flash or XML format, or special input controls. You could convert it to a purely
HTML form by removing the initial “cf” prefix from the tag names, and the form would work.
The following table shows the format of form control tags:
The following listing shows the form source in detail. To test the form and use it as input for later
examples in this chapter, save this code as formpage.cfm.
<html>
<head>
<title>Input form</title>
</head>
<body>
<!--- Specify the action page in the form tag. The form variables will
pass to this page when the form is submitted. --->
Control Code
Text control
<cfinput type="Text" name="ControlName" size="Value" maxlength="Value">
List (select) box
<cfselect name="ControlName">
<option value="Value1">DisplayName1
<option value="Value2">DisplayName2
<option value="Value3">DisplayName3
</cfselect>
Radio buttons
<cfinput type="Radio" name="ControlName" value="Value1">DisplayName1
<cfinput type="Radio" name="ControlName" value="Value2">DisplayName2
<cfinput type="Radio" name="ControlName" value="Value3">DisplayName3
Check box
<cfinput type="Checkbox" name="ControlName" value="Yes|No">Yes
Reset button
<cfinput type="Reset" name="ControlName" value="DisplayName">
Submit button
<cfinput type="Submit" name="ControlName" value="DisplayName">