FormViewHelper extends AbstractFormViewHelper

Form ViewHelper. Generates a :html:`<form>` Tag.

Basic usage

Use :html:<f:form> to output an HTML :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 :html: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.

Table of Contents

Properties

$extensionService  : ExtensionService
$formActionUriArguments  : array<string|int, mixed>
We need the arguments of the formActionUri on requesthash calculation therefore we will store them in here right after calling uriBuilder
$hashService  : HashService
$mvcPropertyMappingConfigurationService  : MvcPropertyMappingConfigurationService
$persistenceManager  : PersistenceManagerInterface
$tagName  : string

Methods

initializeArguments()  : mixed
Initialize arguments.
injectExtensionService()  : mixed
injectHashService()  : mixed
injectMvcPropertyMappingConfigurationService()  : mixed
injectPersistenceManager()  : mixed
render()  : string
Render the form.
addFieldNamePrefixToViewHelperVariableContainer()  : mixed
Adds the field name prefix to the ViewHelperVariableContainer
addFormFieldNamesToViewHelperVariableContainer()  : mixed
Adds a container for form field names to the ViewHelperVariableContainer
addFormObjectNameToViewHelperVariableContainer()  : mixed
Adds the form object name to the ViewHelperVariableContainer if "objectName" argument or "name" attribute is specified.
addFormObjectToViewHelperVariableContainer()  : mixed
Adds the object that is bound to this form to the ViewHelperVariableContainer if the formObject attribute is specified.
getDefaultFieldNamePrefix()  : string
Retrieves the default field name prefix for this form
getFieldNamePrefix()  : string
Get the field name prefix
getFormObjectName()  : string
Returns the name of the object that is bound to this form.
postProcessUriArgumentsForRequestHash()  : mixed
Add the URI arguments after postprocessing to the request hash as well.
prefixFieldName()  : string
Prefixes / namespaces the given name with the form field prefix
registerFieldNameForFormTokenGeneration()  : mixed
Register a field name for inclusion in the HMAC / Form Token generation
removeCheckboxFieldNamesFromViewHelperVariableContainer()  : mixed
Remove Checkbox field names from ViewHelper variable container, to start from scratch when a new form starts.
removeFieldNamePrefixFromViewHelperVariableContainer()  : mixed
Removes field name prefix from the ViewHelperVariableContainer
removeFormFieldNamesFromViewHelperVariableContainer()  : mixed
Removes the container for form field names from the ViewHelperVariableContainer
removeFormObjectFromViewHelperVariableContainer()  : mixed
Removes the form object from the ViewHelperVariableContainer.
removeFormObjectNameFromViewHelperVariableContainer()  : mixed
Removes the form name from the ViewHelperVariableContainer.
renderAdditionalIdentityFields()  : string
Render additional identity fields which were registered by form elements.
renderHiddenIdentityField()  : string
Renders a hidden form field containing the technical identity of the given object.
renderHiddenReferrerFields()  : string
Renders hidden form fields for referrer information about the current controller and action.
renderTrustedPropertiesField()  : string
Render the request hash field
setFormActionUri()  : mixed
Sets the "action" attribute of the form tag

Properties

$formActionUriArguments

We need the arguments of the formActionUri on requesthash calculation therefore we will store them in here right after calling uriBuilder

protected array<string|int, mixed> $formActionUriArguments

$tagName

protected string $tagName = 'form'

Methods

initializeArguments()

Initialize arguments.

public initializeArguments() : mixed

render()

Render the form.

public render() : string
Return values
string

rendered form

addFieldNamePrefixToViewHelperVariableContainer()

Adds the field name prefix to the ViewHelperVariableContainer

protected addFieldNamePrefixToViewHelperVariableContainer() : mixed

addFormFieldNamesToViewHelperVariableContainer()

Adds a container for form field names to the ViewHelperVariableContainer

protected addFormFieldNamesToViewHelperVariableContainer() : mixed

addFormObjectNameToViewHelperVariableContainer()

Adds the form object name to the ViewHelperVariableContainer if "objectName" argument or "name" attribute is specified.

protected addFormObjectNameToViewHelperVariableContainer() : mixed

addFormObjectToViewHelperVariableContainer()

Adds the object that is bound to this form to the ViewHelperVariableContainer if the formObject attribute is specified.

protected addFormObjectToViewHelperVariableContainer() : mixed

getDefaultFieldNamePrefix()

Retrieves the default field name prefix for this form

protected getDefaultFieldNamePrefix() : string
Return values
string

default field name prefix

getFieldNamePrefix()

Get the field name prefix

protected getFieldNamePrefix() : string
Return values
string

getFormObjectName()

Returns the name of the object that is bound to this form.

protected getFormObjectName() : string

If the "objectName" argument has been specified, this is returned. Otherwise the name attribute of this form. If neither objectName nor name arguments have been set, NULL is returned.

Return values
string

specified Form name or NULL if neither $objectName nor $name arguments have been specified

postProcessUriArgumentsForRequestHash()

Add the URI arguments after postprocessing to the request hash as well.

protected postProcessUriArgumentsForRequestHash(array<string|int, mixed> $arguments, array<string|int, mixed> &$results[, string $currentPrefix = '' ][, int $level = 0 ]) : mixed
Parameters
$arguments : array<string|int, mixed>
$results : array<string|int, mixed>
$currentPrefix : string = ''
$level : int = 0

prefixFieldName()

Prefixes / namespaces the given name with the form field prefix

protected prefixFieldName(string $fieldName) : string
Parameters
$fieldName : string

field name to be prefixed

Return values
string

namespaced field name

registerFieldNameForFormTokenGeneration()

Register a field name for inclusion in the HMAC / Form Token generation

protected registerFieldNameForFormTokenGeneration(string $fieldName) : mixed
Parameters
$fieldName : string

name of the field to register

removeCheckboxFieldNamesFromViewHelperVariableContainer()

Remove Checkbox field names from ViewHelper variable container, to start from scratch when a new form starts.

protected removeCheckboxFieldNamesFromViewHelperVariableContainer() : mixed

removeFieldNamePrefixFromViewHelperVariableContainer()

Removes field name prefix from the ViewHelperVariableContainer

protected removeFieldNamePrefixFromViewHelperVariableContainer() : mixed

removeFormFieldNamesFromViewHelperVariableContainer()

Removes the container for form field names from the ViewHelperVariableContainer

protected removeFormFieldNamesFromViewHelperVariableContainer() : mixed

removeFormObjectFromViewHelperVariableContainer()

Removes the form object from the ViewHelperVariableContainer.

protected removeFormObjectFromViewHelperVariableContainer() : mixed

removeFormObjectNameFromViewHelperVariableContainer()

Removes the form name from the ViewHelperVariableContainer.

protected removeFormObjectNameFromViewHelperVariableContainer() : mixed

renderAdditionalIdentityFields()

Render additional identity fields which were registered by form elements.

protected renderAdditionalIdentityFields() : string

This happens if a form field is defined like property="bla.blubb" - then we might need an identity property for the sub-object "bla".

Return values
string

HTML-string for the additional identity properties

renderHiddenIdentityField()

Renders a hidden form field containing the technical identity of the given object.

protected renderHiddenIdentityField(object $object, string $name) : string
Parameters
$object : object

Object to create the identity field for

$name : string

Name

Tags
see
Argument::setValue()
Return values
string

A hidden field containing the Identity (UID in TYPO3 Flow, uid in Extbase) of the given object or NULL if the object is unknown to the persistence framework

renderHiddenReferrerFields()

Renders hidden form fields for referrer information about the current controller and action.

protected renderHiddenReferrerFields() : string
Tags
todo

filter out referrer information that is equal to the target (e.g. same packageKey)

Return values
string

Hidden fields with referrer information

renderTrustedPropertiesField()

Render the request hash field

protected renderTrustedPropertiesField() : string
Return values
string

The hmac field

setFormActionUri()

Sets the "action" attribute of the form tag

protected setFormActionUri() : mixed

        
On this page

Search results