User Guide

cfform 157
In HTML format, all tags, and in Flash format the cftree and cfgrid tags, require JavaScript
support on the browser. The
cfapplet tag and applet format cfgrid, cfslider, and cftree
tags require the client to download a Java applet.
If you specify Flash format in the
cfform tag, ColdFusion ignores any HTML in the form body.
You must use ColdFusion tags, such as
cfinput, for all form controls. You can include individual
Flash format
cfgrid and cftree controls in an HTML format cfform tag.
In Flash format, if your forms do not request sensitive data (such as credit card numbers),
consider setting the
timeout attribute. This can prevent users from getting "The form data has
expired, Please reload this page in your browser" errors if they use the browser back button to
return to the form. For more information, see “Caching data in Flash forms” in Chapter 29,
“Caching data in Flash forms,”in ColdFusion MX Developers Guide.
Note: In Flash format, if you do not specify height and width attributes, Flash reserves browser space
equal to the area of the browser window. If any other output follows the form, users must scroll to see
it. Therefore, if you follow a Flash form with additional output, specify the
height and width values.
If attribute value text must include quotation marks, escape them by doubling them.
Using the onError attribute in Flash forms
If you use onSubmit or onBlur validation, the onError attribute lets you specify ActionScript
code to execute if the user tries to submit a Flash form with validation errors, as follows:
If you specify one or more valid Flash expressions, Flash executes the expressions.
If you omit the attribute, Flash displays a dialog box with all applicable error messages.
If you specify onError="" (an empty string) Flash does not display any message, but does not
submit the form.
Your ActionScript can use the errors variable to determine the fields and errors. The errors object
has the following fields:
The following example shows
cfform tags with an onError attribute that selects the tab in an
accordion or tabnavigator that contains a
lastName field with an invalid entry:
<cfform name="form1" format="flash" width="800" height="500"
onError="if (errors['lastName'] != undefined
){tabA.selectedIndex=0; _root.lastName.setFocus();}">
Field Contents
name The
name attribute of the control’s CFML tag.
field The internal name used by Flash for the field. name (for example,
_level0.field1)
value The value in the field.
message The
message attribute of the control’s CFML tag.