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:

absolute

absolute
Type
bool
Default
false
If set, an absolute action URI is rendered (only active if $actionUri is not set)

action

action
Type
string
Target action

actionUri

actionUri
Type
string
can be used to overwrite the "action" attribute of the form tag

addQueryString

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.

additionalAttributes

additionalAttributes
Type
array
Additional tag attributes. They will be added directly to the resulting HTML tag.

additionalParams

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)

arguments

arguments
Type
array
Default
array ( )
Arguments (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)

argumentsToBeExcludedFromQueryString

argumentsToBeExcludedFromQueryString
Type
array
Default
array ( )
arguments to be removed from the action URI. Only active if $addQueryString = TRUE and $actionUri is not set

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

controller

controller
Type
string
Target controller

data

data
Type
array
Additional data-* attributes. They will each be added with a "data-" prefix.

extensionName

extensionName
Type
string
Target Extension Name (without `tx_` prefix and no underscores). If NULL the current extension name is used

fieldNamePrefix

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

format

format
Type
string
Default
''
The requested format (e.g. ".html") of the target page (only active if $actionUri is not set)

hiddenFieldClassName

hiddenFieldClassName
Type
string
hiddenFieldClassName

method

method
Type
string
Default
'post'
Transfer type (get or post)

name

name
Type
string
Name of form

noCache

noCache
Type
bool
Default
false
set this to disable caching for the target page. You should not need this.

novalidate

novalidate
Type
bool
Indicate that the form is not to be validated on submit.

object

object
Type
mixed
Object to use for the form. Use in conjunction with the "property" attribute on the sub tags

objectName

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

pageType

pageType
Type
int
Default
0
Target page type

pageUid

pageUid
Type
int
Target page uid

pluginName

pluginName
Type
string
Target plugin. If empty, the current plugin name is used

requestToken

requestToken
Type
mixed
whether to add that request token to the form

section

section
Type
string
Default
''
The anchor to be added to the action URI (only active if $actionUri is not set)

signingType

signingType
Type
string
which signing type to be used on the request token (falls back to "nonce")