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>
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>
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
Allows arbitrary arguments
This ViewHelper allows you to pass arbitrary arguments not defined below directly
to the HTML tag created. This includes custom
data-
arguments.
The following arguments are available for the form ViewHelper:
-
absolute
¶ -
- Type
- bool
- Default
- false
If set, an absolute action URI is rendered (only active if $actionUri is not set)
-
accesskey
¶ -
- Type
- string
Keyboard shortcut to access this element
-
action
¶ -
- Type
- string
Target action
-
actionUri
¶ -
- Type
- string
can be used to overwrite the "action" attribute of the form tag
-
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
¶ -
- Type
- array
Additional tag attributes. They will be added directly to the resulting HTML tag.
-
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
¶ -
- Type
- array
- Default
- array ( )
Arguments (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)
-
argumentsToBeExcludedFromQueryString
¶ -
- Type
- array
- Default
- array ( )
arguments to be removed from the action URI. Only active if $addQueryString = TRUE and $actionUri is not set
-
aria
¶ -
- Type
- array
Additional aria-* attributes. They will each be added with a "aria-" prefix.
-
class
¶ -
- Type
- string
CSS class(es) for this element
-
controller
¶ -
- Type
- string
Target controller
-
data
¶ -
- Type
- array
Additional data-* attributes. They will each be added with a "data-" prefix.
-
dir
¶ -
- Type
- string
Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left)
-
enctype
¶ -
- Type
- string
MIME type with which the form is submitted
-
extensionName
¶ -
- Type
- string
Target Extension Name (without `tx_` prefix and no underscores). If NULL the current extension name is used
-
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
¶ -
- Type
- string
- Default
- ''
The requested format (e.g. ".html") of the target page (only active if $actionUri is not set)
-
- Type
- string
hiddenFieldClassName
-
id
¶ -
- Type
- string
Unique (in this file) identifier for this HTML element.
-
lang
¶ -
- Type
- string
Language for this element. Use short names specified in RFC 1766
-
method
¶ -
- Type
- string
- Default
- 'post'
Transfer type (get or post)
-
name
¶ -
- Type
- string
Name of form
-
noCache
¶ -
- Type
- bool
- Default
- false
set this to disable caching for the target page. You should not need this.
-
novalidate
¶ -
- Type
- bool
Indicate that the form is not to be validated on submit.
-
object
¶ -
- Type
- mixed
Object to use for the form. Use in conjunction with the "property" attribute on the sub tags
-
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
-
onclick
¶ -
- Type
- string
JavaScript evaluated for the onclick event
-
onreset
¶ -
- Type
- string
JavaScript: On reset of the form
-
onsubmit
¶ -
- Type
- string
JavaScript: On submit of the form
-
pageType
¶ -
- Type
- int
- Default
- 0
Target page type
-
pageUid
¶ -
- Type
- int
Target page uid
-
pluginName
¶ -
- Type
- string
Target plugin. If empty, the current plugin name is used
-
requestToken
¶ -
- Type
- mixed
whether to add that request token to the form
-
section
¶ -
- Type
- string
- Default
- ''
The anchor to be added to the action URI (only active if $actionUri is not set)
-
signingType
¶ -
- Type
- string
which signing type to be used on the request token (falls back to "nonce")
-
style
¶ -
- Type
- string
Individual CSS styles for this element
-
tabindex
¶ -
- Type
- integer
Specifies the tab order of this element
-
target
¶ -
- Type
- string
Target attribute of the form
-
title
¶ -
- Type
- string
Tooltip text of element