Skip to main content

form_errors

The error category strings for errors from a form created by a form tag.

The following table outlines the strings that can be returned and the reason that they would be:

Form property nameReturn reason
authorThere were issues with required name fields.
bodyThere were issues with required text content fields.
emailThere were issues with required email fields.
formThere were general issues with the form.
passwordThere were issues with required password fields.

Properties

Anchor to
messages
array of string

The translated error messages for each value in the form_errors array.

You can access a specific message in the array by using a specific error from the form_errors array as a key.

Anchor to
translated_fields
array of string

The translated names for each value in the form_errors array.

You can access a specific field in the array by using a specific error from the form_errors array as a key.

{
"messages": {},
"translated_fields": {}
}

You can output the name of the field related to the error, and the error message, by using the error as a key to access the translated_fields and messages properties.

<ul>
{% for error in form.errors %}
<li>
{% if error == 'form' %}
{{ form.errors.messages[error] }}
{% else %}
{{ form.errors.translated_fields[error] }} - {{ form.errors.messages[error] }}
{% endif %}
</li>
{% endfor %}
</ul>
Was this section helpful?