---
title: "Form.hasErrors ViewHelper <f:form.hasErrors>"
manual: "Fluid ViewHelper Reference"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-form-haserrors@main"
source: "Global/Form/HasErrors.rst"
rendered: "2026-09-25T05:46:13+00:00"
---

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

ViewHelper which checks whether a property has validation errors, implemented as a condition like an "if" construct. Errors of sub properties count as well, so "author" is true if only "author.email" has an error.

```
  <div class="{f:form.hasErrors(for: 'blog.title', then: 'has-error')}">
    <f:form.textfield property="title" />
  </div>

  <f:form.hasErrors for="blog.title">
    <f:then>
       The title has at least one validation error.
    </f:then>
    <f:else>
       The title is fine.
    </f:else>
  </f:form.hasErrors>

```

Use `<f:form.validationResults>` instead to access the error objects themselves.

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

**Arguments**

The following arguments are available for the form.hasErrors ViewHelper:

-   **else**

    -   *Type:* mixed

    Value to be returned if the condition if not met.

-   **for**

    -   *Type:* string
    -   *Required:* true

    The property path to check, for example "blog.title".

-   **then**

    -   *Type:* mixed

    Value to be returned if the condition if met.
