Form ViewHelper <f:form>

Form ViewHelper. Generates a <form> Tag. Tailored for extbase plugins, uses extbase Request.

Basic usage

Use <f:form> to output an HTML <form> tag which is targeted at the specified action, in the current controller and package. It will submit the form data via a POST request. If you want to change this, use method="get" as an argument.

Examples

A complex form with a specified encoding type

Form with enctype set:

<f:form action=".." controller="..." package="..." enctype="multipart/form-data">...</f:form>
Copied!

A Form which should render a domain object

Binding a domain object to a form:

<f:form action="..." name="customer" object="{customer}">
   <f:form.hidden property="id" />
   <f:form.textarea property="name" />
</f:form>
Copied!

This automatically inserts the value of {customer.name} inside the textarea and adjusts the name of the textarea accordingly.

Source code

Go to the source code of this ViewHelper: FormViewHelper.php (GitHub).

Arguments

The following arguments are available for the form ViewHelper:

additionalAttributes
Type
array
Additional tag attributes. They will be added directly to the resulting HTML tag.
data
Type
array
Additional data-* attributes. They will each be added with a "data-" prefix.
aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.
action
Type
string
Target action
arguments
Type
array
Default
array ( )
Arguments (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)
controller
Type
string
Target controller
extensionName
Type
string
Target Extension Name (without `tx_` prefix and no underscores). If NULL the current extension name is used
pluginName
Type
string
Target plugin. If empty, the current plugin name is used
pageUid
Type
int
Target page uid
object
Type
mixed
Object to use for the form. Use in conjunction with the "property" attribute on the sub tags
pageType
Type
int
Default
0
Target page type
noCache
Type
bool
Default
false
set this to disable caching for the target page. You should not need this.
section
Type
string
Default
''
The anchor to be added to the action URI (only active if $actionUri is not set)
format
Type
string
Default
''
The requested format (e.g. ".html") of the target page (only active if $actionUri is not set)
additionalParams
Type
array
Default
array ( )
additional action URI query parameters that won't be prefixed like $arguments (overrule $arguments) (only active if $actionUri is not set)
absolute
Type
bool
Default
false
If set, an absolute action URI is rendered (only active if $actionUri is not set)
addQueryString
Type
string
Default
false
If set, the current query parameters will be kept in the URL. If set to "untrusted", then ALL query parameters will be added. Be aware, that this might lead to problems when the generated link is cached.
argumentsToBeExcludedFromQueryString
Type
array
Default
array ( )
arguments to be removed from the action URI. Only active if $addQueryString = TRUE and $actionUri is not set
fieldNamePrefix
Type
string
Prefix that will be added to all field names within this form. If not set the prefix will be tx_yourExtension_plugin
actionUri
Type
string
can be used to overwrite the "action" attribute of the form tag
objectName
Type
string
name of the object that is bound to this form. If this argument is not specified, the name attribute of this form is used to determine the FormObjectName
hiddenFieldClassName
Type
string
hiddenFieldClassName
requestToken
Type
mixed
whether to add that request token to the form
signingType
Type
string
which signing type to be used on the request token (falls back to "nonce")
method
Type
string
Default
'post'
Transfer type (get or post)
name
Type
string
Name of form
novalidate
Type
bool
Indicate that the form is not to be validated on submit.