Errors object

The Errors object contains all special and general error handling, typically used to display at the top of the form. Common examples would be using to display Spam-related errors or even custom errors in cases where a custom plugin is extending Freeform's functionality.

Properties

  • error #
    • Returns the special or general error.

Usage in Templates

When used in conjunction with the hasErrors variable, the following code will render a list of special or general errors within a form:

{% if form.hasErrors %}
  <div class="freeform-form-has-errors">
    {{ "There was an error submitting this form"|t }}

    {% if form.errors|length %}
      <ul>
        {% for error in form.errors %}
          <li>{{ error }}</li>
        {% endfor %}
      </ul>
    {% endif %}
  </div>
{% endif %}
1
2
3
4
5
6
7
8
9
10
11
12
13
Last Updated: 1/15/2019, 12:09:09 AM