584
Chapter 27: Building Dynamic Forms
Creating forms with the cfform tag
You already learned how to use HTML forms to gather user input (see
Chapter 26, “Retrieving
and Formatting Data,” on page 559
). This chapter shows you how to use the
cfform
tag to create
dynamic forms in CFML. In addition to standard HTML form controls, the
cfform
tag allows
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
cfform
controls offer input validation attributes that you can use to validate user entry,
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
cfform
tags and passes to the browser any
HTML code that it finds in the form. As a result, you can also do the following:
•
You can use the
passthrough
attribute of the
cfform
,
cfinput
, and
cfselect
tags to enter
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
form
tags with
cfform
and your forms will work fine.
•
ColdFusion passes to the action page of the
cfform
the variable Form.fieldnames, which
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
cfform
. You can use these tags only inside a
cfform
tag.
Control
Description
For more information
cfgrid
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.
“Creating data grids with cfgrid”
on page 595
.
cfslider
Java applet-based control that defines a slider.
“Building slider bar controls”
on page 595
.
cfinput
Places radio buttons, check boxes, text input
boxes, and password entry boxes. Equivalent to
the HTML
input
tag with the addition of input
validation.
“Input validation with cfform
controls” on page 609
.
cftree
Java applet-based controls that define a tree
control and individual tree control items.
“Building tree controls with
cftree” on page 586
.
cftextinput
Java applet-based control that defines a text
input box.
“Building text input boxes”
on page 594
.
Summary of Contents for ColdFusion MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......