Form.hasErrors ViewHelper <f: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>
Copied!
Use <f: instead to access the error objects themselves.
Go to the source code of this ViewHelper: Form\HasErrorsViewHelper.php (GitHub).
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
- 1
The property path to check, for example "blog.title".
then
-
- Type
- mixed
Value to be returned if the condition if met.