<p>Relational field validation (entries, assets, tags, users, etc.) works the same on the front-end as any other custom field would.</p>

<p>So if you have an Entries field with a handle <code>houseCollege</code> on an entry and it's marked as required and there is nothing submitted on the front-end for it, then using the error macro you mentioned:</p>

<pre><code>{% macro errorList(errors) %}
    {% if errors %}
        &lt;ul class="errors"&gt;
            {% for error in errors %}
                &lt;li&gt;{{ error }}&lt;/li&gt;
            {% endfor %}
        &lt;/ul&gt;
    {% endif %}
{% endmacro %}
</code></pre>

<p>You would display any validation errors for that <code>houseCollege</code> field with:</p>

<pre><code>{% if entry is defined %}
    {{ errorList(entry.getErrors('houseCollege')) }}
{% endif %}
</code></pre>

<p>And in the case of a missing required field, you'd get:</p>

<pre><code>House College cannot be blank.
</code></pre>

CC BY-SA 3.0
2016-06-21T22:14:40.727Z
2016-06-21T22:14:40.727Z
Brad Bell
<p>I am having some issues understanding why validation is not working on my entry forms.</p>

<p>I've got an entry with several field types which aren't of type "entries" and the required validation is working properly on my front end forms using craft's error macro</p>

<pre><code>{% macro errorList(errors) %}
    {% if errors %}
        {% for error in errors %}
        {% endfor %}
    {% endif %}
{% endmacro %}
</code></pre>

<p>The validation is NOT working on my fields which are of type "entries". Do you have to pass in the error object differently to the macro since "entries" are an array?</p>

<p>I have tried calling the error macro like this...</p>

<pre><code>{% if entry is defined %}
    {{ formErrors.errorList(entry.getErrors('houseCollege[0]')) }}
{% endif %}
</code></pre>

<p>and this...</p>

<pre><code>{% if entry is defined %}
    {{ formErrors.errorList(entry.getErrors('houseCollege[]')) }}
{% endif %}
</code></pre>

<p>and this...</p>

<pre><code>{% if entry is defined %}
    {{ formErrors.errorList(entry.getErrors('houseCollege')) }}
{% endif %}
</code></pre>

<p>and yes, I have this field marked as required in the CP.</p>

<p>Also I don't know how relevant this is, but in the form this value is being filled by a select element.</p>

<form><frontend><entries-field><validation>
Entries Field Type Validation
# Entries Field Type Validation

(Asked by: username_0 on 2015-07-06)

I am having some issues understanding why validation is not working on my entry forms.
I've got an entry with several field types which aren't of type "entries" and the required validation is working properly on my front end forms using craft's error macro
{% macro errorList(errors) %}
    {% if errors %}
        {% for error in errors %}
        {% endfor %}
    {% endif %}
{% endmacro %}

The validation is NOT working on my fields which are of type "entries". Do you have to pass in the error object differently to the macro since "entries" are an array?
I have tried calling the error macro like this...
{% if entry is defined %}
    {{ formErrors.errorList(entry.getErrors('houseCollege[0]')) }}
{% endif %}

and this...
{% if entry is defined %}
    {{ formErrors.errorList(entry.getErrors('houseCollege[]')) }}
{% endif %}

and this...
{% if entry is defined %}
    {{ formErrors.errorList(entry.getErrors('houseCollege')) }}
{% endif %}

and yes, I have this field marked as required in the CP.
Also I don't know how relevant this is, but in the form this value is being filled by a select element.

**Tags:** form, frontend, entries-field, validation

---

## 1 answers

### Answer by username_1 on 2016-06-21. Score: 1

Relational field validation (entries, assets, tags, users, etc.) works the same on the front-end as any other custom field would.
So if you have an Entries field with a handle houseCollege on an entry and it's marked as required and there is nothing submitted on the front-end for it, then using the error macro you mentioned:
{% macro errorList(errors) %}
    {% if errors %}
        
            {% for error in errors %}
                {{ error }}
            {% endfor %}
        
    {% endif %}
{% endmacro %}

You would display any validation errors for that houseCollege field with:
{% if entry is defined %}
    {{ errorList(entry.getErrors('houseCollege')) }}
{% endif %}

And in the case of a missing required field, you'd get:
House College cannot be blank.


---

