Creating forms with the cfform tag
You already learned how to use HTML forms to gather user input (see
and Formatting Data," on page
dynamic forms in CFML. In addition to standard HTML form controls, the
you to create forms that contain the following controls:
•
Text boxes in which you can specify the appearance, such as fonts and colors
•
Text inputs that allow you to validate the data entered into the control
•
Predefined ColdFusion Java applet based controls, including trees, sliders, and grids
•
Custom Java applets that act as form elements
Most
controls offer input validation attributes that you can use to validate user entry,
cfform
selection, or interaction. This means you do not have to write separate CFML code specifically
for input validation, as you do in HTML forms.
Using HTML and cfform
ColdFusion dynamically generates HTML forms from
HTML code that it finds in the form. As a result, you can also do the following:
•
You can use the
any HTML attributes that are not explicitly allowed in these tags. The attribute values are
passed through to the HTML generated by these form tags.
•
You can replace your existing HTML
•
ColdFusion passes to the action page of the
contains the names of the form fields submitted from the form.
The cfform controls
The following table describes the ColdFusion controls that you use in forms created using
. You can use these tags only inside a
cfform
Control
cfgrid
cfslider
cfinput
cftree
cftextinput
584
Chapter 27: Building Dynamic Forms
559). This chapter shows you how to use the
attribute of the
passthrough
Description
Java applet-based control that creates a data
grid that you can populate from a query or by
defining the contents of individual cells. You can
also use grids to insert, update, and delete
records from a data source.
Java applet-based control that defines a slider.
Places radio buttons, check boxes, text input
boxes, and password entry boxes. Equivalent to
the HTML input tag with the addition of input
validation.
Java applet-based controls that define a tree
control and individual tree control items.
Java applet-based control that defines a text
input box.
cfform
,
cfform
cfinput
tags with
form
cfform
the variable Form.fieldnames, which
cfform
tag.
cfform
Chapter 26, "Retrieving
tag to create
cfform
cfform
tags and passes to the browser any
, and
tags to enter
cfselect
and your forms will work fine.
For more information
"Creating data grids with cfgrid"
on page
595.
"Building slider bar controls"
on page
595.
"Input validation with cfform
controls" on page
609.
"Building tree controls with
cftree" on page
586.
"Building text input boxes"
on page
594.
tag allows
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers