cfform

Builds a form with CFML custom control tags; these provide
more functionality than standard HTML form input elements.

 <cfform>

 cfform();

Attribute Reference for the cfform tag

name

Required: No
In HTML format, if you omit this attribute and specify
an id attribute, ColdFusion does not include a name
attribute in the HTML sent to the browser; this
behavior lets you use the cfform tag to create
XHTML-compliant forms. If you omit the name
attribute and the id attribute, ColdFusion generates
a name of the form CFForm_n where n is a number
that assigned serially to the forms on a page.

action

Required: No
Name of CFML page to execute when the form is
submitted for processing.

method

Required: No
Default: post
The method the browser uses to send the form data
to the server:
- post: Send the data using the HTTP post method,
This method sends the data in a separate message
to the server.
- get: Send the data using the HTTP get method,
which puts the form field contents in the URL
query string. Values:
  • post
  • get

format

Required: No
Default: html
- HTML: Generate an HTML form and send it to the client.
- Flash: DEPRECATED in CF 11+ Generate a Flash form and send it to the client. All controls are in Flash format.
- XML: DEPRECATED in CF 11+ Generate XForms-compliant XML and save
the results in a variable specified by the name
attribute. By default, ColdFusion also applies an XSL skin and displays the result. Values:
  • html
  • flash
  • xml

skin

Required: No
DEPRECATED in CF 11+
Flash: Use a Macromedia halo color to stylize the output.
XML: Specfies whether to apply an XSL skin and
display the resulting HTML to the client. Can be any
of the following:
- ColdFusion MX skin name: Apply the specified skin.
- XSL file name: Apply the skin located in the specified path.
- "none": Do not apply an XSL skin. You must use XForms XML then.
- (omitted) or "default": Use the ColdFusion MX default skin. Values:
  • haloSilver
  • haloBlue
  • haloGreen
  • haloOrange
  • beige
  • blue
  • bluegray
  • lightgray
  • red
  • silver
  • none
  • default
  • basic
  • basiccss

preservedata

Required: No
Default: NO
When the cfform action attribute posts back to the same
page as the form, this determines whether to override the
control values with the submitted values.
- false: values specified in the control tag attributes are used
- true: corresponding submitted values are used

onload

Required: No
JavaScript to execute when the form loads.

onsubmit

Required: No
JavaScript or Actionscript function to execute to
preprocess data before form is submitted. If any
child tags specify onSubmit field validation, ColdFusion
does the validation before executing this JavaScript.

codebase

Required: No
Default: /CFIDE/classes/cf-j2re-win.cab
URL of downloadable JRE plug-in (for Internet Explorer only).
Default: /CFIDE/classes/cf-j2re-win.cab

archive

Required: No
Default: /CFIDE/classes/cfapplets.jar
URL of downloadable Java classes for CFML controls.
Default: /CFIDE/classes/cfapplets.jar

height

Required: No
Default: 100%
The height of the form. Use a number to specify
pixels, In Flash, you can use a percentage value to
specify a percentage of the available width. The
displayed height might be less than the specified size.

width

Required: No
Default: 100%
The width of the form. Use a number to specify
pixels, In Flash, you can use a percentage value to
specify a percentage of the available width.

onerror

Required: No
Applies only for onSubmit or onBlur validation; has
no effect for onServer validation. An ActionScript
expression or expressions to execute if the user
submits a form with one or more validation errors.

wmode

Required: No
Default: window
Specifies how the Flash form appears relative to
other displayable content that occupies the same
space on an HTML page.
- window: The Flash form is the topmost layer on the
page and obscures anything that would share the
space, such as drop-down dynamic HTML lists.
- transparent: The Flash form honors the z-index of
dhtml so you can float items above it. If the Flash
form is above any item, transparent regions in the
form show the content that is below it.
- opaque: The Flash form honors the z-index of
dhtml so you can float items above it. If the Flash
form is above any item, it blocks any content that is
below it.
Default is: window. Values:
  • window
  • transparent
  • opaque

accessible

Required: No
Default: NO
Specifies whether to include support screen readers
in the Flash form. Screen reader support adds
approximately 80KB to the SWF file sent to the
client. Default is: false.

preloader

Required: No
Default: YES
Specifies whether to display a progress bar when
loading the Flash form. Default is: true.

timeout

Required: No
Integer number of seconds for which to keep the
form data in the Flash cache on the server. A value of
0 prevents the data from being cached.

scriptsrc

Required: No
Specifies the URL, relative to the web root, of the
directory that contains the cfform.js file with the
client-side JavaScript used by this tag and its child
tags. For XML format forms, this directory is also the
default directory for XSLT skins.

style

Required: No
Styles to apply to the form. In HTML or XML format,
ColdFusion passes the style attribute to the browser
or XML. In Flash format, must be a style specification
in CSS format.

onreset

Required: No
JavaScript to execute when the user clicks a reset button.

id

Required: No
HTML id passed through to
.

target

Required: No
Target window or frame passed through to .

passthrough

Required: No
DEPRECATED in CF 7+ REMOVED in CF 11+ Passes arbitrary attribute-value pairs to the HTML code
that is generated for the tag. You can use either of the
following formats:

passthrough="title=""myTitle"""
passthrough='title="mytitle"'

onsuccess

Required: No
Applies only to forms inside cfdiv, cflayout, cfpod, or cfwindow controls. The name of a JavaScript function that will run when an asynchronous form submission succeeds.

Compatibility

ColdFusion:

ColdFusion 11 DEPRECATED format=flash, format=xml and format=applet

Fork me on GitHub