---
title: "Form.hidden ViewHelper <f:form.hidden>"
manual: "Fluid ViewHelper Reference"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-form-hidden@main"
source: "Global/Form/Hidden.rst"
modified: "2026-09-17T05:12:06+00:00"
---

# Form.hidden ViewHelper `<f:form.hidden>`

ViewHelper which renders an `<input type="hidden" ...>` tag.

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

**Table of contents**

-   [Hidden field bound to a controller argument](https://docs.typo3.org/permalink/t3viewhelper:hidden-field-bound-to-a-controller-argument@main)
-   [Use case: Creating a comment for a specific blog post](https://docs.typo3.org/permalink/t3viewhelper:use-case-creating-a-comment-for-a-specific-blog-post@main)
-   [Arguments of the form hidden ViewHelper](https://docs.typo3.org/permalink/t3viewhelper:arguments-of-the-form-hidden-viewhelper@main)

## Hidden field bound to a controller argument

Hidden fields can be used to pass additional arguments to a controller action.

**Fluid**

The form includes a hidden field to pass the blog post UID:

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

```html
<f:form action="save" controller="Comment" method="post">
    <f:form.hidden name="commentId" value="{comment.id}" />
    <f:form.textfield name="message" value="{comment.message}" />
    <f:form.submit value="Save" />
</f:form>

```

**Controller**

The controller action can then look like this:

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

```php
<?php

declare(strict_types=1);

namespace Vendor\Extension\Controller;

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

class CommentController extends ActionController
{
  public function saveAction(string $message, ?string $commentId = null): ResponseInterface
  {
    if ($commentId === null) {
      // Create new comment
      $this->addFlashMessage('Created a new comment');
    } else {
      // Fetch and update an existing comment
      $this->addFlashMessage('Updated comment with ID ' . $commentId);
    }
    return $this->redirect('list');
  }
}

```

> [!TIP]
> In a `<f:form>` with the [method](https://docs.typo3.org/permalink/t3viewhelper:viewhelper-argument-typo3-cms-fluid-viewhelpers-formviewhelper-method@main)
> set to `post`, the content of hidden fields is sent in the POST body.
> This is ideal for data that should not be visible in the URL or is too
> large to include in the query string.

## Use case: Creating a comment for a specific blog post

You have:

-   A `Comment` domain model that relates to a `BlogPost`
-   A `BlogPost` detail page that includes a comment form
-   The property `blogPost` is set automatically and not selectable by the user

**Fluid**

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

```html
<f:form action="create" controller="Comment" method="post" object="{comment}">
    <f:form.hidden property="blogPost" value="{blogPost.uid}" />
    <f:form.textfield property="authorName" />
    <f:form.textarea property="content" />
    <f:form.submit value="Submit Comment" />
</f:form>

```

**Model**

The domain model includes a relation to the BlogPost entity:

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

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Domain\Model;

use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

class Comment extends AbstractEntity
{
  protected string $authorName = '';
  protected string $content = '';
  protected BlogPost $blogPost;

  // Getters and setters...
}

```

**Controller**

The controller saves the comment and redirects to the related blog post:

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

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Controller;

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

class CommentController extends ActionController
{
  public function createAction(Comment $comment): ResponseInterface
  {
    // $comment->getBlogPost() returns the associated BlogPost object
    $this->commentRepository->add($comment);
    $this->addFlashMessage('Your comment was submitted!');
    return $this->redirect('show', 'BlogPost', null, ['blogPost' => $comment->getBlogPost()]);
  }
}

```

> [!TIP]
> Use a hidden field to bind a new object (like a `Comment`) to its parent
> (like a `BlogPost`). This keeps the relation intact without exposing
> it in the user interface.
>
> In this example, the `blogPost` property is set via a hidden input and
> automatically mapped back to a domain object using Extbase's property
> mapping.

## Arguments of the form hidden ViewHelper

-   **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.

-   **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.

-   **respectSubmittedDataValue**

    -   *Type:* bool
    -   *Default:* true

    enable or disable the usage of the submitted values

-   **value**

    -   *Type:* mixed

    Value of input tag
