TIP

WE'RE HIRING! 💼

The Solspace team is expanding! If you love Craft CMS and you’re looking for an exciting full-time remote position working on software development for the Freeform and Calendar plugins for Craft and more, we’d love to hear from you!

Check Out Job Listing!

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/14/2020, 3:35:55 PM