<cfform>
Builds a form with CFML custom control tags that provide more functionality than standard HTML form input elements (XML and Flash type not supported).
This tag must have a body.
This tag is also supported within <cfscript>
Requires Extension: Form Tags for Jakarta EE (Lucee 7+)
<cfform
name=string
action=string
preserveData=boolean
enableCAB=boolean
target=string
method=string
encType=string
passThrough=any
codeBase=string
archive=string
scriptSrc=string
id=string
onError=string
onReset=string
onLoad=string
onSubmit=string
style=string
class=string
format=string
skin=string
width=string
height=string
preloader=boolean
timeout=number
wMode=string
accessible=boolean
accept=string
acceptcharset=string
title=string
dir=string
lang=string
onclick=string
ondblclick=string
onmousedown=string
onmouseup=string
onmouseover=string
onmousemove=string
onmouseout=string
onkeypress=string
onkeyup=string
onkeydown=string
><!--- body ---></cfform>
| Attribute | Description |
|---|---|
name
string, optional
|
edit
A name for the form you are creating. |
action
string, optional
|
edit
The name of the page that executed when the form is submitted for processing. |
target
string, optional
|
edit
The name of the window or window frame to which the form output is sent. |
method
string, optional
|
edit
other than post will ignored |
encType
string, optional
|
edit
The MIME type used to encode data sent by the POST method. The default value is application/x-www-form-urlencoded. It is recommended that you accept the default value. This attribute is included for compatibility with the HTML form tag. |
passThrough
any, optional
|
edit
Used for HTML attributes that are not explicitly supported by cfform. If you specify an attribute and value, they are passed to the HTML code that is generated for the cfinput tag. |
codeBase
string, optional
|
edit
URL for a downloadable JRE plugin (for Internet explorer only). Default is /CFIDE/classes/cf-j2re-win.cab. |
archive
string, optional
|
edit
URL for a downloadable Java classes for controls. |
scriptSrc
string, optional
|
edit
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. |
id
string, optional
|
edit
HTML id passed through to form tag created, only used for type html. |
onError
string, optional
|
edit
The name of a JavaScript function that runs if a form submission fails. |
onReset
string, optional
|
edit
JavaScript to execute when the user clicks a reset button. |
onLoad
string, optional
|
edit
JavaScript to execute when the form loads. |
onSubmit
string, optional
|
edit
JavaScript function to execute after other input validation returns. Use this attribute to execute JavaScript for preprocessing data before the form is submitted |
style
string, optional
|
edit
Styles to apply to the form. In HTML or XML format, Lucee passes the style attribute to the browser or XML. In Flash format, must be a style specification in CSS format (XML and Flash type not supported). |
class
string, optional
|
edit
passed through to form tag created, only used for type html. |
format
string, optional
|
edit
passed through to form tag created, only used for type html. |
accept
string, optional
|
edit
passed through to form tag created, only used for type html. |
acceptcharset
string, optional
|
edit
passed through to form tag created, only used for type html. |
title
string, optional
|
edit
passed through to form tag created, only used for type html. |
dir
string, optional
|
edit
passed through to form tag created, only used for type html. |
lang
string, optional
|
edit
passed through to form tag created, only used for type html. |
onclick
string, optional
|
edit
passed through to form tag created, only used for type html. |
ondblclick
string, optional
|
edit
passed through to form tag created, only used for type html. |
onmousedown
string, optional
|
edit
passed through to form tag created, only used for type html. |
onmouseup
string, optional
|
edit
passed through to form tag created, only used for type html. |
onmouseover
string, optional
|
edit
passed through to form tag created, only used for type html. |
onmousemove
string, optional
|
edit
passed through to form tag created, only used for type html. |
onmouseout
string, optional
|
edit
passed through to form tag created, only used for type html. |
onkeypress
string, optional
|
edit
passed through to form tag created, only used for type html. |
onkeyup
string, optional
|
edit
passed through to form tag created, only used for type html. |
onkeydown
string, optional
|
edit
passed through to form tag created, only used for type html. |
Unimplemented Attribute(s)
| Attribute | Description |
|---|---|
preserveData
boolean,
optional
|
edit
Optional. "Yes" or "No." Specifies whether to display the data that was entered into cfform controls in the action page. "Yes" resets the value of the control to the value submitted when the form is submitted to itself. This works as expected for the cftextinput and cfslider controls. This attribute can be used only if the form and action are on a single page, or if the action page has a form that contains controls with the same names as the corresponding controls on the form page. This has not yet been implemented https://luceeserver.atlassian.net/browse/LDEV-1171 * unimplemented * |
enableCAB
boolean,
optional
|
edit
This attribute has been deprecated and is non-functional. * deprecated * |
skin
string,
optional
|
edit * unimplemented * |
width
string,
optional
|
edit
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. * unimplemented * |
height
string,
optional
|
edit
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. * unimplemented * |
preloader
boolean,
optional
|
edit
Specifies whether to display a progress bar when loading the Flash form. Default is: true. * unimplemented * |
timeout
number,
optional
|
edit
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. * unimplemented * |
wMode
string,
optional
|
edit
Specifies how the Flash form appears relative to other displayable content that occupies the same space on an HTML page.
Default is: window. * unimplemented * |
accessible
boolean,
optional
|
edit
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. * unimplemented * |
Examples
edit<cfform name="mycfform">
-- year --
<br />
<cfselect name="year" enabled=true style="color:blue;" size=2>
<option name="0" selected=true>--2024--</option>
<option name="1">--2023--</option>
<option name="3">--2022--</option>
<option name="2">--2021--</option>
</cfselect> <br />
-- color --
<br />
<cfselect name="color" >
<option name="0">--red--</option>
<option name="1">--green--</option>
<option name="2">--blue--</option>
</cfselect>
</cfform>
See also
- Ajax features
- <cfinput>
- <cfselect>
- <cfslider>
- <cftextarea>
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)