
710
DEVELOPING
COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Las
t
upda
te
d 8/5/2010
<cfinput type="Text" name="FirstName" size="20" maxlength="35" required="Yes"
message="You must enter your first name.">
If you use a hidden field tag, you customize the message using the
value
attribute of the hidden field, as follows:
<input type="hidden" name="FirstName_required"
value="You must enter your first name.">
Form variable notes and considerations
When using form variables in an action page, keep in mind the following guidelines:
•
A form variable is available on the action page and pages that it includes.
•
Prefix form variables with "Form."when referencing them on the action page.
•
Surround variable values with number signs (#) for output.
•
Variables for check boxes, radio buttons, and list boxes with
size
attributes greater than 1 only get passed to the
action page if you select an option. Text boxes, passwords, and text area fields pass an empty string if you do not
enter text.
•
An error occurs if the action page tries to use a variable that was not passed.
•
If multiple controls have the same name, one form variable is passed to the action page with a comma-delimited
list of values.
•
You can validate form variable values on the client or the server.
Working with queries and data
The ability to generate and display query data is one of the most important and flexible features of ColdFusion. Some
of these tools are effective for presenting any data, not just query results.
Using HTML tables to display query results
You can use HTML tables to specify how the results of a query appear on a page. To do so, you place the
cfoutput
tag
inside
the table tags. You can also use the HTML
th
tag to place column labels in a header row. To create a row in the
table for each row in the query results, place the
tr
block inside the
cfoutput
tag.
In addition, you can use CFML functions to format individual pieces of data, such as dates and numeric values.
Place the query results in a table
1
Open the ColdFusion actionpage.cfm page in your editor.
2
Modify the page so that it appears as follows:
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...