Form Notes And Considerations; Processing Form Variables On Action Pages; Dynamically Generating Sql Statements - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

34

Form Notes and Considerations

To make the coding process easy to follow, name form controls the same as
target database fields.
Limit radio buttons to three-to-five mutually exclusive options.
If you need more than that many options, consider a dropdown select box.
Use select boxes to allow the user to choose multiple items.
All the data that you collect on a form is automatically passed as form variables
to the associated action page.
Checkboxes and radio buttons do not pass to action pages unless they are
selected on a form. In fact, if you try to reference these variables on the action
page, you will receive an error if they are not present.
You can dynamically populate dropdown select boxes using query data. See
"Dynamically Populating Select Boxes" on page 46

Processing Form Variables on Action Pages

A ColdFusion action page is just like any other application page except that you can
use the form variables that are passed to it from an associated form. A form variable is
passed for every form control that contains a value when the form is submitted.
Note
A form variable's name is the name that you assigned to the form control on the form
page. Refer to form variable by name within tags, functions and other expressions on
an action page.
Because form variables extend beyond the local page — their scope is the action page
— prefix them with "form." to explicitly tell ColdFusion that you are referring to a form
variable. For example this code references the LastName form variable for output on
an action page:
<CFOUTPUT>
#Form.LastName#
</CFOUTPUT>

Dynamically Generating SQL Statements

As you've already learned, you can retrieve a record for every employee in a database
table by composing a query like this:
<CFQUERY NAME="GetEmployees" DATASOURCE="CompanyInfo">
SELECT
FROM
</CFQUERY>
If multiple controls have the same name, one form variable is passed to
the action page. It contains a comma delimited list.
FirstName, LastName, Contract
Employees
Developing Web Applications with ColdFusion
for details.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?

This manual is also suitable for:

Coldfusion 4.5

Table of Contents