User Guide

250 Chapter 2: ColdFusion Tags
The following pattern enforces entry of a part number of the format EB-1234-c1-098765, where
the user starts the entry by typing the first numeric character, such as 3. ColdFusion fills in the
preceding EA prefix and all - characters. The user must enters four numbers, followed by two
alphanumeric characters, followed by six numbers.
<cfinput type="text" name="newPart" mask="EB-9999-XX-999999" />
Note: To force a pattern to be all-uppercase or all-lowercase, use the ColdFusion
UCase or LCase
functions in the action page.
For tags with type="datefield" (and cfcalendar tags), the number of pattern characters
determines the format of the output, as follows:
The following pattern specifies that the Flash forms sends the date selected using a
datefield
input control to ColdFusion as text in the format 04/29/2004:
<cfinput name="startDate" type="datefield" label="date:" mask="mm/dd/yyyy"/>
Flash form data binding
The bind attribute lets you populate form fields using the contents of other form fields. To
specify text from another field in a
cftextarea bind attribute, use the following format:
{sourceTagName.text}
For example, the following line uses the values from the firstName and lastName fields to
construct an email address. (The user can change or replace this value with a typed entry.)
<cfinput type="text" name="email" label="email"
bind="{firstName.text}.{lastName.text}@mm.com">
Example
<!--- This example shows the use of cfinput within a cfform to ensure simple
validation of text items. --->
<cfform action = "cfinput.cfm">
<!--- Phone number validation. --->
Mask Pattern
D Single- or double-digit day of month, such as 1 or 28
DD Double-digit day of month, such as 01 or 28
M Single- or double-digit month, such as 1 or 12
MM Double-digit month, such as 01 or 12
MMM Abbreviated month name, such as Jan or Dec
MMMM Full month name, such as January or December
YY Two-character year, such as 05
YYYY Four-character year, such as 2005
E Single-digit day of week, such as 1 or 7
EEE Abbreviated day of week name, such as Mon or Sun
EEEE Full month day of week name, such as Monday or Sunday