Answers.Body: <p>It's probably not possible to get the sections you limited your entries field to from the template and if there's no entry selected that's what you'd need to do.</p>
  
  <p>But what I'd recommend and what's generally a pretty solid approach in such situations is to build an associative array with all the necessary data and loop through that array:</p>
  
  <pre><code>{% set relationsGroups = {
      'entriesField1': 'Heading Relations 1',
      'entriesField2': 'Heading Relations 2',
      'entriesField3': 'Heading Relations 3',
  } %}
  
  {% for fieldHandle, heading in relationsGroups %}
      {% set assets = craft.entries({
          relatedTo: {
              sourceElement: entry,
              field: fieldHandle
          }
          order: 'sortOrder',
          limit: null
      }) %}
  
      {% for asset in assets %}
          &lt;li&gt;{{ heading }}: {{ asset.title }}&lt;/li&gt;
      {% else %}
          &lt;li&gt;{{ heading }}: Empty&lt;/li&gt;
      {% endfor %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-22T15:03:00.950Z
Answers.LastActivityDate: 2015-08-22T16:11:16.957Z
Answers.LastEditDate: 2015-08-22T16:11:16.957Z
Answers.UserDisplayName: carlcs
Body: <p>I am using <a href="http://buildwithcraft.com/docs/entries-fields" rel="nofollow">Entries Field</a> to display related content. I have several Entries Field in an article and i also want to display the fields that are empty, but with their section name.... Is this even possible? I am quite new to Craft, so don't know if I am even in a right direction... Help will be highly appriciated!</p>
  
  <pre><code>{% set assets = craft.entries({
    relatedTo: { 
      sourceElement: entry, 
        field: ['entry','entry2','entry3']
      },
      order:     "sortOrder",
      limit:     null
    })  
  %}
  
  {% if assets %}
    {% for asset in assets %}
        {% if asset|title %}
          {{ asset.section.name }}: {{ asset.title }}
        {% else }
          {{ asset.section.name }}: Empty
        {% endif }
    {% endfor %}
  {% endif %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-21T01:14:08.263Z
Comments.Text: Can you clarify a bit what you are trying to do? Are the different entry fields for different sections, and you want to show the section title even if there are no selected related entries?
Comments.UserDisplayName: Aaron Berkowitz
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-21T05:25:15.583Z
Comments.Text: *"display the fields that are empty, but with their section name"* – what do you mean with section name? The field's title? Or did you limit the entries field to one section only and want to show that?
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-21T06:07:55.843Z
Comments.Text: Yes, that is completely right. I want to show the section name even if there are no selected entries.
Comments.UserDisplayName: Fredrik
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-21T10:28:48.260Z
Comments.Text: I could make them as separates Asset Fields in the template and put a header ove hit. But i really want they displayed in an array. Because it could be a lot of sections (not only 3 as now).
Comments.UserDisplayName: Fredrik
Tags: <elementcriteriamodel><entries-field>
Title: Multiple Entries fields, show empty ones?
ThreadText: # Multiple Entries fields, show empty ones?
  
  (Asked by: username_0 on 2015-08-20)
  
  I am using [Entries Field](http://buildwithcraft.com/docs/entries-fields) to display related content. I have several Entries Field in an article and i also want to display the fields that are empty, but with their section name.... Is this even possible? I am quite new to Craft, so don't know if I am even in a right direction... Help will be highly appriciated!
  
  ```
  {% set assets = craft.entries({
    relatedTo: { 
      sourceElement: entry, 
        field: ['entry','entry2','entry3']
      },
      order:     "sortOrder",
      limit:     null
    })  
  %}
  
  {% if assets %}
    {% for asset in assets %}
        {% if asset|title %}
          {{ asset.section.name }}: {{ asset.title }}
        {% else }
          {{ asset.section.name }}: Empty
        {% endif }
    {% endfor %}
  {% endif %}
  
  ```
  
  **Tags:** elementcriteriamodel, entries-field
  
  > **Comments:**
  > **username_1**: Can you clarify a bit what you are trying to do? Are the different entry fields for different sections, and you want to show the section title even if there are no selected related entries?  
  > **username_2**: *"display the fields that are empty, but with their section name"* – what do you mean with section name? The field's title? Or did you limit the entries field to one section only and want to show that?  
  > **username_0**: Yes, that is completely right. I want to show the section name even if there are no selected entries.  
  > **username_0**: I could make them as separates Asset Fields in the template and put a header ove hit. But i really want they displayed in an array. Because it could be a lot of sections (not only 3 as now).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-08-22. Score: 1 | Accepted answer
  
  It's probably not possible to get the sections you limited your entries field to from the template and if there's no entry selected that's what you'd need to do.
  
  But what I'd recommend and what's generally a pretty solid approach in such situations is to build an associative array with all the necessary data and loop through that array:
  
  ```
  {% set relationsGroups = {
      'entriesField1': 'Heading Relations 1',
      'entriesField2': 'Heading Relations 2',
      'entriesField3': 'Heading Relations 3',
  } %}
  
  {% for fieldHandle, heading in relationsGroups %}
      {% set assets = craft.entries({
          relatedTo: {
              sourceElement: entry,
              field: fieldHandle
          }
          order: 'sortOrder',
          limit: null
      }) %}
  
      {% for asset in assets %}
          <li>{{ heading }}: {{ asset.title }}</li>
      {% else %}
          <li>{{ heading }}: Empty</li>
      {% endfor %}
  {% endfor %}
  
  ```
  
  
  ---
  
  