---
title: "Form.textarea ViewHelper <f:form.textarea>"
manual: "Fluid ViewHelper Reference"
version: "14.3"
permalink: "https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-form-textarea@14.3"
source: "Global/Form/Textarea.rst"
rendered: "2026-10-01T16:43:06+00:00"
---

# Form.textarea ViewHelper `<f:form.textarea>` {#typo3-fluid-form-textarea}

ViewHelper which renders a `<textarea>` large text input area inside a form.

The value of the text area needs to be set via the `value` attribute, as with all other f:form ViewHelpers.

Go to the source code of this ViewHelper: [Form\\TextareaViewHelper.php (GitHub)](https://github.com/TYPO3/typo3/blob/main/typo3/sysext/fluid/Classes/ViewHelpers/Form/TextareaViewHelper.php).

**Table of contents**

-   [A basic text area bound to an action argument](https://docs.typo3.org/permalink/t3viewhelper:a-basic-text-area-bound-to-an-action-argument@14.3)
-   [Property binding: A text area bound to a model property](https://docs.typo3.org/permalink/t3viewhelper:property-binding-a-text-area-bound-to-a-model-property@14.3)
-   [Arguments of the textarea form field ViewHelper](https://docs.typo3.org/permalink/t3viewhelper:arguments-of-the-textarea-form-field-viewhelper@14.3)

> [!WARNING]
> User input, especially from free text fields, may contain harmful content.
> Sanitize all input data and prevent
> [Cross-site scripting (XSS)](https://docs.typo3.org/m/typo3/reference-coreapi/14.3/en-us/Security/TypesOfThreats/Index.html#security-xss).
>
> Also consider if [SQL injection](https://docs.typo3.org/m/typo3/reference-coreapi/14.3/en-us/Security/TypesOfThreats/Index.html#security-sql-injection)
> is possible.

## A basic text area bound to an action argument {#typo3-fluid-form-textarea-example}

This example shows how to bind a textarea to an Extbase controller action
argument.

This approach is appropriate when you want to handle input directly in a
controller action, without relying on a domain model or Data Transfer Object (DTO).

**Fluid**

**packages/my_extension/Resources/Private/Templates/Contact/ShowForm.fluid.html**

```html
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
      data-namespace-typo3-fluid="true">

<f:form action="sendMessage" controller="Contact" method="post">

    <label for="tx-contact-name">Your Name:</label>
    <f:form.textfield name="name" id="tx-contact-name" required="true" />
    <label for="tx-contact-message">Message:</label>
    <f:form.textarea name="message" id="tx-contact-message" required="true" />

    <f:form.submit class="button" value="Send" />
</f:form>

</html>

```

**Controller**

The controller action can then look like this:

**packages/my_extension/Classes/Controller/ContactController.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Controller;

use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class ContactController extends ActionController
{
  public function sendMessageAction(string $name, string $message): ResponseInterface
  {
    // Process data
    $this->addFlashMessage('Your message was received.');
    return $this->redirect('showForm');
  }
  // ...
}

```

## Property binding: A text area bound to a model property {#typo3-fluid-form-textarea-example-property}

Using the [property](https://docs.typo3.org/permalink/t3viewhelper:viewhelper-argument-typo3-cms-fluid-viewhelpers-form-textfieldviewhelper-property@14.3)
argument, a text field can be bound to the property of an
[Extbase model](https://docs.typo3.org/m/typo3/reference-coreapi/14.3/en-us/ExtensionArchitecture/Extbase/Domain/Model.html#extbase-model).

For this, the surrounding form must also define the
[object](https://docs.typo3.org/permalink/t3viewhelper:viewhelper-argument-typo3-cms-fluid-viewhelpers-formviewhelper-object@14.3)
property. As the textarea ViewHelper may provide texts longer than 255 chars,
the TCA for the field should be of type [Text areas & RTE](https://docs.typo3.org/m/typo3/reference-tca/14.3/en-us/ColumnsConfig/Type/Text/Index.html#columns-text).
This ensures that the auto-generated database field will also be of type `TEXT`,
which is suitable for longer content.”

**Fluid**

**packages/my_extension/Resources/Private/Templates/Blog/Comment.fluid.html**

```html
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
      data-namespace-typo3-fluid="true">

<f:form action="create"
        controller="Comment"
        objectName="comment"
        object="{newComment}"
        method="post">

        <label for="tx-myextension-email">E-Mail:</label>
        <f:form.textfield property="email"
                          type="email"
                          id="tx-myextension-email" />

        <label for="tx-myextension-content">Message:</label>
        <f:form.textarea property="content"
                         id="tx-myextension-content"
                         rows="8"
                         cols="46" />

        <f:form.submit class="button"
                       value="Submit" />

</f:form>
</html>

```

**Controller**

The controller action can then look like this:

**packages/my_extension/Classes/Controller/CommentController.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Controller;

use MyVendor\MyExtension\Domain\Model\Comment;
use MyVendor\MyExtension\Domain\Repository\CommentRepository;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Annotation\IgnoreValidation;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class CommentController extends ActionController
{
  public function __construct(
    protected readonly CommentRepository $commentRepository,
  ) {}

  #[IgnoreValidation(['argumentName' => 'newComment'])]
  public function commentFormAction(?Comment $newComment = null): ResponseInterface
  {
    if ($newComment === null) {
      $newComment = new Comment();
      $newComment->setDate(new \DateTime());
    }
    // The assigned object will be used in argument object
    $this->view->assign('newComment', $newComment);
    return $this->htmlResponse();
  }

  public function createAction(
    // This parameter must have the same name as argument `objectName` of f:form
    Comment $comment,
  ): ResponseInterface {
    $this->commentRepository->add($comment);
    $this->addFlashMessage('Comment was saved');
    return $this->redirect('show');
  }
}

```

**Model**

**packages/my_extension/Classes/Domain/Model/Comment.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Domain\Model;

use TYPO3\CMS\Extbase\Annotation\Validate;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

class Comment extends AbstractEntity
{
  #[Validate(['validator' => 'EmailAddress'])]
  protected string $email = '';

  #[Validate(['validator' => 'StringLength', 'options' => ['maximum' => 500]])]
  protected string $content = '';

  // Getters and setters ...
}

```

**TCA Configuration**

**packages/my_extension/Configuration/TCA/tx_myextension_domain_model_comment.php**

```php
<?php

return [
  'ctrl' => [
    'title' => 'Comment',
    'label' => 'email',
    // ...
  ],
  'types' => [
    '1' => ['showitem' => 'email, content'],
  ],
  'columns' => [
    'email' => [
      'label' => 'Email',
      'config' => [
        'type' => 'email',
      ],
    ],
    'content' => [
      'label' => 'Message',
      'config' => [
        'type' => 'text',
      ],
    ],
  ],
];

```

## Arguments of the textarea form field ViewHelper {#typo3-fluid-form-textarea-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.

-   **additionalAttributes**

    -   *Type:* array

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

-   **aria**

    -   *Type:* array

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

-   **data**

    -   *Type:* array

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

-   **errorClass**

    -   *Type:* string
    -   *Default:* 'f3-form-error'

    CSS class to set if there are errors for this ViewHelper

-   **name**

    -   *Type:* string

    Name of input tag

-   **property**

    -   *Type:* string

    Name of Object Property. If used in conjunction with \<f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

-   **required**

    -   *Type:* bool
    -   *Default:* false

    Specifies whether the textarea is required

-   **value**

    -   *Type:* mixed

    Value of input tag
