Answers.Body: <p>So this is what worked for me. It's a bootstrap drop-down menu system using the nav tag from the structure 'menu' with custom fields as described above</p>
  
  <pre><code>&lt;ul class="nav navbar-nav navbar-right"&gt;
  {% set menu = craft.entries.section('menu').hidePage('&lt; 1') %}
  {% set navlink = "" %}
  
  {% nav entry in menu %}
      {% if entry.entryLink.first|length %}
      {% set navlink = entry.entryLink.first.uri %}
      {% else %}
      {% set navlink = entry.customMenuUrl %}
      {% endif %}
  
      {% if entry.level == 1 and entry.children|length %}
          &lt;li class="dropdown"&gt;
              &lt;a  href="{{ siteUrl }}{{ navlink}}"  role="button" data-hover="dropdown" data-length="{{ entry.title|length }}" aria-haspopup="true" aria-expanded="false"&gt;{{ entry.title }}&lt;span class="caret"&gt;&lt;/span&gt;&lt;/a&gt;
              &lt;!-- get children --&gt;
              &lt;ul class="dropdown-menu" &gt;
                  &lt;!-- get children --&gt;
                  {% for child in entry.getDescendants().hidePage('&lt; 1') %}
                  {% if child.entryLink.first|length %}
  
                  &lt;li&gt; &lt;a  href="{{ siteUrl }}{{  child.entryLink.first.uri }}" class="{{ macros.isActiveChildClass(child.slug) | trim }} level{{ child.level }}"&gt;{{ child.entryLink.first.title }}&lt;/a&gt;&lt;/li&gt;
                  {% endif %}
                  {% endfor %}
              &lt;/ul&gt;
          &lt;/li&gt;
      {% elseif entry.level == 1 and not entry.hasDescendants() %}
       &lt;li&gt;&lt;a href="{{ siteUrl }}{{ navlink }}" class="{{ macros.isParentMenuActive(entry.slug) |trim }} level{{ entry.level }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
      {% endif %}
  
  
  {% endnav %}
  </code></pre>
  
  <p></p>
  
  <p>This has managed to produce a bootstrap drop down menu from the nav tag on a structure section with two fields: customMenuUrl (plain text) and entryLink (Entries field)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-25T11:58:07.907Z
Answers.LastActivityDate: 2016-11-25T16:56:59.117Z
Answers.LastEditDate: 2016-11-25T16:56:59.117Z
Answers.UserDisplayName: joomkit
Body: <p>I am building a navigation section which is a structure. The idea is that it is a flexible place to build links to other entries/ custom urls etc. It has one entry.type called page which has an entries Field called 'entryLink' to link to other entries.</p>
  
  <p>It has no urls of its own set in 'Entries in this section have their own URLs'.</p>
  
  <p>When i try to get the entriesField called 'entryLink' all i can get is the title: </p>
  
  <pre><code> {% set navEntries = craft.entries.section('navigation').hidePage('&lt; 1')  %}
     {% for nav in navEntries %}
       &lt;p&gt; {{ nav.entryLink.first() }}&lt;/p&gt;
   {% endfor %}
  </code></pre>
  
  <p>If i try and get the slug or uri I always get an error. Eg when using :</p>
  
  <pre><code> {% set navEntries = craft.entries.section('navigation').hidePage('&lt; 1')  %}
     {% for nav in navEntries %}
       &lt;p&gt; {{ nav.entryLink.first().uri }}&lt;/p&gt;
   {% endfor %}
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>Impossible to access an attribute ("uri") on a null variable
  </code></pre>
  
  <p>What am I missing?
  I notice the documentation here: <a href="https://craftcms.com/docs/entries-fields" rel="nofollow noreferrer">https://craftcms.com/docs/entries-fields</a>
  specifies 'target locale' which i do not have in my entrie field setup.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-25T03:22:32.263Z
Comments.Text: If you solved your own problem, please post it as an **answer** instead of adding it to the question. You can accept your own answer.
Comments.UserDisplayName: Lindsey D
Tags: <structure><navigation>
Title: Getting the URI of an Entries field in a Structure with no URLs
ThreadText: # Getting the URI of an Entries field in a Structure with no URLs
  
  (Asked by: username_0 on 2016-11-24)
  
  I am building a navigation section which is a structure. The idea is that it is a flexible place to build links to other entries/ custom urls etc. It has one entry.type called page which has an entries Field called 'entryLink' to link to other entries.
  
  It has no urls of its own set in 'Entries in this section have their own URLs'.
  
  When i try to get the entriesField called 'entryLink' all i can get is the title:
  
  ```
   {% set navEntries = craft.entries.section('navigation').hidePage('< 1')  %}
     {% for nav in navEntries %}
       <p> {{ nav.entryLink.first() }}</p>
   {% endfor %}
  
  ```
  
  If i try and get the slug or uri I always get an error. Eg when using :
  
  ```
   {% set navEntries = craft.entries.section('navigation').hidePage('< 1')  %}
     {% for nav in navEntries %}
       <p> {{ nav.entryLink.first().uri }}</p>
   {% endfor %}
  
  ```
  
  I get
  
  ```
  Impossible to access an attribute ("uri") on a null variable
  
  ```
  
  What am I missing?
  I notice the documentation here: <https://craftcms.com/docs/entries-fields>
  specifies 'target locale' which i do not have in my entrie field setup.
  
  **Tags:** structure, navigation
  
  > **Comments:**
  > **username_1**: If you solved your own problem, please post it as an **answer** instead of adding it to the question. You can accept your own answer.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-11-25. Score: 1
  
  So this is what worked for me. It's a bootstrap drop-down menu system using the nav tag from the structure 'menu' with custom fields as described above
  
  ```
  <ul class="nav navbar-nav navbar-right">
  {% set menu = craft.entries.section('menu').hidePage('< 1') %}
  {% set navlink = "" %}
  
  {% nav entry in menu %}
      {% if entry.entryLink.first|length %}
      {% set navlink = entry.entryLink.first.uri %}
      {% else %}
      {% set navlink = entry.customMenuUrl %}
      {% endif %}
  
      {% if entry.level == 1 and entry.children|length %}
          <li class="dropdown">
              <a  href="{{ siteUrl }}{{ navlink}}"  role="button" data-hover="dropdown" data-length="{{ entry.title|length }}" aria-haspopup="true" aria-expanded="false">{{ entry.title }}<span class="caret"></span></a>
              <!-- get children -->
              <ul class="dropdown-menu" >
                  <!-- get children -->
                  {% for child in entry.getDescendants().hidePage('< 1') %}
                  {% if child.entryLink.first|length %}
  
                  <li> <a  href="{{ siteUrl }}{{  child.entryLink.first.uri }}" class="{{ macros.isActiveChildClass(child.slug) | trim }} level{{ child.level }}">{{ child.entryLink.first.title }}</a></li>
                  {% endif %}
                  {% endfor %}
              </ul>
          </li>
      {% elseif entry.level == 1 and not entry.hasDescendants() %}
       <li><a href="{{ siteUrl }}{{ navlink }}" class="{{ macros.isParentMenuActive(entry.slug) |trim }} level{{ entry.level }}">{{ entry.title }}</a></li>
      {% endif %}
  
  {% endnav %}
  
  ```
  
  This has managed to produce a bootstrap drop down menu from the nav tag on a structure section with two fields: customMenuUrl (plain text) and entryLink (Entries field)
  
  
  ---
  
  