startFormTag()
Description
Builds and returns a string containing the opening form tag. The form's action will be built according to the same rules as URLFor.
Function Syntax
startFormTag([ method, multipart, spamProtection, route, controller, action, key, params, anchor, onlyPath, host, protocol, port ])
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
method |
string |
No | post |
The type of method to use in the form tag, get and post are the options. |
multipart |
boolean |
No | false |
Set to true if the form should be able to upload files. |
spamProtection |
boolean |
No | false |
Set to true to protect the form against spammers (done with JavaScript). |
route |
string |
No | |
Name of a route that you have configured in config/routes.cfm. |
controller |
string |
No | |
Name of the controller to include in the URL. |
action |
string |
No | |
Name of the action to include in the URL. |
key |
any |
No | |
Key(s) to include in the URL. |
params |
string |
No | |
Any additional params to be set in the query string. |
anchor |
string |
No | |
Sets an anchor name to be appended to the path. |
onlyPath |
boolean |
No | true |
If true, returns only the relative URL (no protocol, host name or port). |
host |
string |
No | |
Set this to override the current host. |
protocol |
string |
No | |
Set this to override the current protocol. |
port |
numeric |
No | 0 |
Set this to override the current port number. |
Examples
<!--- view code --->
<cfoutput>
#startFormTag(action="create", spamProtection=true)#
<!--- your form controls --->
#endFormTag()#
</cfoutput>
