<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

<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

A name for the form you are creating.

action
string, optional

The name of the page that executed when the form is submitted for processing.

target
string, optional

The name of the window or window frame to which the form output is sent.

method
string, optional

other than post will ignored

enctype
string, optional

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

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

URL for a downloadable JRE plugin (for Internet explorer only). Default is /CFIDE/classes/cf-j2re-win.cab.

archive
string, optional

URL for a downloadable Java classes for controls.

scriptsrc
string, optional

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

HTML id passed through to form tag created, only used for type html.

onerror
string, optional

The name of a JavaScript function that runs if a form submission fails.

onreset
string, optional

JavaScript to execute when the user clicks a reset button.

onload
string, optional

JavaScript to execute when the form loads.

onsubmit
string, optional

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

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

passed through to form tag created, only used for type html.

format
string, optional

passed through to form tag created, only used for type html.

accept
string, optional

passed through to form tag created, only used for type html.

acceptcharset
string, optional

passed through to form tag created, only used for type html.

title
string, optional

passed through to form tag created, only used for type html.

dir
string, optional

passed through to form tag created, only used for type html.

lang
string, optional

passed through to form tag created, only used for type html.

onclick
string, optional

passed through to form tag created, only used for type html.

ondblclick
string, optional

passed through to form tag created, only used for type html.

onmousedown
string, optional

passed through to form tag created, only used for type html.

onmouseup
string, optional

passed through to form tag created, only used for type html.

onmouseover
string, optional

passed through to form tag created, only used for type html.

onmousemove
string, optional

passed through to form tag created, only used for type html.

onmouseout
string, optional

passed through to form tag created, only used for type html.

onkeypress
string, optional

passed through to form tag created, only used for type html.

onkeyup
string, optional

passed through to form tag created, only used for type html.

onkeydown
string, optional

passed through to form tag created, only used for type html.

Unimplemented Attribute(s)

Attribute Description
preservedata
boolean, optional

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

This attribute has been deprecated and is non-functional.

* deprecated *
skin
string, optional
* unimplemented *
width
string, optional

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

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

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

* unimplemented *
timeout
number, optional

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

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.

* unimplemented *
accessible
boolean, optional

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

<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