Chapter 10: Building Dynamic Forms
validation methods using either a JavaScript or the VALIDATE attribute in
CFTEXTINPUT.
The following example shows a basic CFTEXTINPUT control. This example validates a
date entry, which means that a user must enter a valid date in the form mm/dd/yy. For a
complete list of validation formats, refer to the CFML Language Reference.
<BR>Please enter a date:
<CFFORM NAME="Form1"
ACTION="cfform_submit.cfm"
METHOD="Post">
<CFTEXTINPUT NAME="entertext"
4
VALIDATE="date"
<BR>
<INPUT TYPE="Submit"
</CFFORM>
CFTEXTINPUT form variable
The value of the form variable passed from a CFTEXTINPUT control to a ColdFusion
application page is determined by the entry in the CFTEXTINPUT control. The form
variable is passed as:
textinput_name=textinput_value
In the example just above, the form variable would have been passed as:
entertext=textinput_value
So in the destination application page, the form variable is referenced as #entertext#
Building Drop-Down List Boxes
The drop-down list box you can create with CFSELECT is similar to the HTML SELECT
tag. However, CFSELECT gives you more control over user inputs, error handling, and
allows you to populate the selection list from a query.
When you populate a CFSELECT with data from a query, you only need to specify the
name of the query that is supplying data for the CFSELECT and the query column
name for each list element you want to display.
VALUE="mm/dd/yy"
MAXLENGTH="10"
FONT="Trebuchet MS">
VALUE="Submit">
143
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?