Whatever message this page gives is out now! Go check it out!
<cfform
accessible = "yes|no" (Removed)
action = "form action"
format = "HTML"
height = "pixels|percent" (Removed)
id = "HTML id" method = "POST|GET"
name = "name"
onError = "JavaScript function name or ActionScript code"
onLoad = "load event script" onReset = "reset event script" onSubmit = "JavaScript"
onSuccess = "JavaScript function name"
preloader = "yes|no"
preserveData = "yes|no"
scriptSrc = "path"
skin = "Flash skin|XSL skin" (Removed)
style = "style specification"
timeout = "seconds" (Removed)
width = "pixels|percent" (Removed)
wMode = "window|transparent|opaque"> (Removed)
...
</cfform>Attribute | Applies to | Req/Opt | Default | Description |
| accessible | Flash | Opt | no | Specifies whether to include support screen readers in the Flash form. Screen reader support adds approximately 80 KB to the SWF file sent to the client. This attribute is removed. |
action | FlashHTMLXML | Opt | See Description | Name of ColdFusion page to execute when the form is submitted for processing. If you omit this attribute and the method is get, the form posts to the page identified by the CGI.SCRIPT_NAME variable (the requested page that resulted in displaying the form). If the method is post, the form posts to the page identified by the CGI.QUERY_STRING variables. |
format | HTML | Opt | HTML |
|
height | FlashXML | Opt | 100% | The height of the form. Use a number to specify pixels. In Flash, you can use a percentage value, such as "height=60%" to specify a percentage of the available width. The displayed height might be less than the specified size. Note: The width and height attributes are required for Flash forms, if they are used inside of a table. This attribute is removed. |
id | name attribute value | the HTML id of the form. | ||
method | FlashHTML XML | Opt | post | The method the browser uses to send the form data to the server:
|
name | FlashHTMLXML | Opt | CFForm_n | A name for the form. 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 is assigned serially to the forms on a page. |
onError | FlashHTML | Opt | For Flash format forms: 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. For HTML format forms: Applies only to forms inside cfdiv, cflayout, cfpod, or cfwindow controls. The name of a JavaScript function that runs if an asynchronous form submission fails. For more information, see the Usage section. | |
onLoad | HTMLXML | Opt | JavaScript to execute when the form loads. | |
onReset | HTMLXML | Opt | JavaScript to execute when the user clicks a reset button. | |
onSubmit | FlashHTMLXML | Opt | 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. | |
onSuccess | HTML | Opt | Applies only to forms inside cfdiv, cflayout, cfpod, or cfwindow controls. The name of a JavaScript function that runs when an asynchronous form submission succeeds. For more information see the Usage section. | |
preloader | Flash | Opt | yes | Specifies whether to display a progress bar when loading the Flash form. |
preserveData | HTMLXML | Opt | no | When the cfform action attribute posts back to the page that contains the form, this attribute determines whether to override the control values with the submitted values.
|
scriptSrc | FlashHTMLXML | Opt | See Description | Specifies the URL, relative to the web root, of the directory that contains ColdFusion JavaScript files, including 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. When you use this attribute, the specified directory must have the same structure as the /CFIDE/scripts directory. For example, if you specify scriptsrc="/resources/myScripts", the JavaScript files used by ColdFusion AJAX features must be in the /resources/myScripts/ajax directory. This attribute is useful if the file is not in the default location. This attribute may be required in some hosting environments and configurations that block access to the /CFIDE directory. The location is set in the ColdFusion Administrator; by default, it is /CFIDE/scripts. Notes: If you specify this attribute, copy the CF_RunActiveContent.js file from the CFIDE/scripts directory to the specified directory. You can have only one scriptsrc attribute on a page, including any cfajaximport tag scriptsrc}}attribute. If you have multiple {{cfform tags, you can specify the scriptsrc attribute in a cfajaximport tag and it applies to all HTML format forms. |
skin | FlashXML | Opt | Flash: {{haloGreen}} XML: default.xsl | Flash: Use a halo color to stylize the output. The skin determines the color used for highlighted and selected elements.
This attribute is removed. |
style | HTML, Flash, XML | Opt | 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. For detailed information on specifying Flash styles, see Creating Forms in Flash in the Developing ColdFusion Applications. | |
timeout | Flash | Opt | 0 | 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. For more information, see Caching data in Flash forms in Best practices for Flash forms in the Developing ColdFusion Applications. This attribute is removed. |
width | FlashXML | Opt | 100% | The width of the form. Use a number to specify pixels. In Flash, you can use a percentage value, such as "width=60%" to specify a percentage of the available width.Note: The width and height attributes are required for Flash forms, if they are used inside of a table. This attribute is removed. |
wMode | Flash | Opt | window | Specifies how the Flash form appears relative to other displayable content that occupies the same space on an HTML page.
This attribute is removed in ColdFusion (2025 release). |
<cfform>
<input type = "Submit" value = " update... ">
</cfform><h3>cfform Example</h3>
<!--- If Form.oncethrough exists, the form has been submitted. --->
<cfif IsDefined("Form.oncethrough")>
<cfif IsDefined("Form.testVal1")>
<h3>Results of Radio Button Test</h3>
<cfif Form.testVal1>Your radio button answer was yes
<cfelse>Your radio button answer was no
</cfif>
</cfif>
<h3>Results of Checkbox Test</h3>
<cfif IsDefined("Form.chkTest2")>
Your checkbox answer was yes
<cfelse>
Your checkbox answer was no
</cfif>
<cfif IsDefined("Form.textSample") AND Form.textSample is not "">
<h3>Results of Credit Card Input</h3>
Your credit card number, <cfoutput>#Form.textSample#</cfoutput>,
was valid under the MOD 10 algorithm.
</cfif>
<cfif IsDefined("Form.sampleSlider")>
<cfoutput>
<h3>You gave this page a rating of #Form.sampleSlider#</h3>
</cfoutput>
</cfif>
<hr noshade="True">
</cfif>
<!--- Begin by calling the cfform tag. --->
<cfform name="cfformexample">
<h4>This example displays radio button input type for cfinput.</h4>
Yes <cfinput type = "Radio" name = "TestVal1" value = "Yes" checked>
No <cfinput type = "Radio" name = "TestVal1" value = "No">
<h4>This example displays checkbox input type for cfinput.</h4>
<cfinput type = "Checkbox" name = "ChkTest2" value = "Yes">
<h4>This shows client-side validation for cfinput text boxes.</h4>
(<i>This item is optional</i>)<br>
Please enter a credit card number:
<cfinput type = "Text" name = "TextSample"
message = "Please enter a Credit Card Number"
validate = "creditcard" required = "No">
<h4>This example shows the use of the cfslider tag.</h4>
Rate your approval of this example from 1 to 10 by sliding control.<br>
1 <cfslider name = "sampleSlider" width="100"
label = "Page Value: " range = "1,10"
message = "Please enter a value from 1 to 10"> 10
<p><cfinput type = "submit" name = "submit" value = "show me the result">
<cfinput type = "hidden" name = "oncethrough" value = "Yes"></p>
</cfform><cfdocument format="pdf">
<cfdocumentsection ../>
...
...
<cfform type="html/xform">
<cfinput type="textbox" name="employeeName" value="#fullName#" readonly="true">
<cfinput type="textbox" name="employeeID" value="#id#" readonly>
<cfselect name="contributionPercentage" options="#optionsStruct#" required="true">
<cfinput type="submit" name="SubmitAsHTTPPost">
<cfinput type="submit" name="SubmitAsPDF" submitType="PDF">
</cfform>
...
...
<cfdocumentsection ../>
</cfdocument>