Answers.Body: <p>You can use this </p>
  
  <pre><code>{% if entry.hasErrors() %}
      Render a message here
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-22T19:57:12.527Z
Answers.LastActivityDate: 2018-06-22T20:02:20.827Z
Answers.LastEditDate: 2018-06-22T20:02:20.827Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I have a guest entry form that's working fine. I'm using Craft-supplied code:</p>
  
  <pre><code>{% macro errorList(errors) %}
    {% if errors %}
      {% for error in errors %}
        {{ error }}{% if not loop.last %}, {% endif %} 
      {% endfor %}
    {% endif %}
  {% endmacro %}
  </code></pre>
  
  <p>And it works fine - field by field:</p>
  
  <pre><code>{% if entry is defined %}
    &lt;p class="help alert"&gt;{{ errorList(entry.getErrors('title')) }}&lt;/p&gt;
  {% endif %}
  </code></pre>
  
  <p>But I can't figure out how to check if there are any errors (and error in any field) so I can display a notification at the top of the page: "There were some problems with your submission".</p>
  
  <pre><code>{% if errorList(entry.getErrors())|length }}
  </code></pre>
  
  <p>doesn't work.</p>
  
Tags: <error><guest-entries><frontend-form>
Title: Check for errors (any) on guest entry form (Craft 3)
ThreadText: # Check for errors (any) on guest entry form (Craft 3)
  
  (Asked by: username_0 on 2018-06-22)
  
  I have a guest entry form that's working fine. I'm using Craft-supplied code:
  
  ```
  {% macro errorList(errors) %}
    {% if errors %}
      {% for error in errors %}
        {{ error }}{% if not loop.last %}, {% endif %} 
      {% endfor %}
    {% endif %}
  {% endmacro %}
  
  ```
  
  And it works fine - field by field:
  
  ```
  {% if entry is defined %}
    <p class="help alert">{{ errorList(entry.getErrors('title')) }}</p>
  {% endif %}
  
  ```
  
  But I can't figure out how to check if there are any errors (and error in any field) so I can display a notification at the top of the page: "There were some problems with your submission".
  
  ```
  {% if errorList(entry.getErrors())|length }}
  
  ```
  
  doesn't work.
  
  **Tags:** error, guest-entries, frontend-form
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-06-22. Score: 2 | Accepted answer
  
  You can use this
  
  ```
  {% if entry.hasErrors() %}
      Render a message here
  {% endif %}
  
  ```
  
  
  ---
  
  