<p>There's not an "elegant" way to do this but you can access the dropdown field by its handle using <code>getFieldByHandle</code>. Something like:</p>

<pre><code>{% set dropdownField = craft.fields.getFieldbyHandle('isotope') %}

  {% for option in dropdownField.settings.options %}
    &lt;li&gt;{{ option.value }}&lt;/li&gt;
  {% endfor %}
</code></pre>

<p>If you need the label instead, just use <code>{{ option.label }}</code></p>

<p>You can also grab a dropdown's options from any entry you know has the field already attached, such as the first entry from your <code>news</code> section for example:</p>

<pre><code>{% set entry = craft.entries.section('news').limit(1)[0] %}

&lt;ul&gt;
{% for option in  entry.isotope.options %}
    &lt;li&gt;{{ option.value }}&lt;/li&gt;
{% endfor %}
&lt;/ul&gt;
</code></pre>

<p>Note: similar to <a href="https://craftcms.stackexchange.com/questions/2205/how-do-i-output-a-dropdowns-values-if-im-on-a-registration-form-not-tied-to-an">this</a> question.</p>

CC BY-SA 3.0
2017-02-07T00:59:33.493Z
Your first approach is just what I needed to print the field options into the isotope data-filter.  Thanks.
Hellyar
CC BY-SA 3.0
2017-02-07T00:22:52.157Z
2017-02-07T00:31:54.123Z
2017-04-13T12:51:00.303Z
RitterKnight
<p>I have a dropdown field with X options.  I want to print each option as a button.</p>

<p>I tried...</p>

<pre><code>&lt;ul&gt;
    {% for option in entry.isotope.options %}
        &lt;li&gt;{{ option }}&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
</code></pre>

<p>isotope = dropdownFieldHandle</p>

<p>But I get the error <code>Variable "entry" does not work'</code>.</p>

CC BY-SA 3.0
2017-02-06T23:30:16.157Z
Are you actually trying to call this in an ``entry`` template? ``entry`` won't [automatically](https://craftcms.com/docs/routing) get created by Craft if you're on a ``category`` or custom route, for example.
RitterKnight
CC BY-SA 3.0
2017-02-06T23:38:34.713Z
No, I am not in the entry template.  I tried  using set to entry in craft.entries.section('posts'), but that just printed out the title of all the entries instead of the handful of options in the dropdown field.
Hellyar
CC BY-SA 3.0
2017-02-07T00:00:27.087Z
That's your problem. Which post are you actually trying to get? When you call ``craft.entries`` you're going to get a group of entries back based on the parameters you specify. You might try something like ``{% set entry = craft.entries.section('posts').slug('post-with-isotope-options')[0] %}`` to get just one entry.
RitterKnight
CC BY-SA 3.0
2017-02-07T00:02:14.090Z
But I don't want the entries.  I just want to print the options in the field dropdown.
Hellyar
CC BY-SA 3.0
2017-02-07T00:35:42.347Z
Gotcha, couple ways to do that, see answer below.
RitterKnight
<templating>
How do I print the options in a dropdown field?
# How do I print the options in a dropdown field?

(Asked by: username_0 on 2017-02-06)

I have a dropdown field with X options.  I want to print each option as a button.
I tried...

    {% for option in entry.isotope.options %}
        {{ option }}
    {% endfor %}


isotope = dropdownFieldHandle
But I get the error Variable "entry" does not work'.

**Tags:** templating

> **Comments:**
> **username_1**: Are you actually trying to call this in an ``entry`` template? ``entry`` won't [automatically](https://craftcms.com/docs/routing) get created by Craft if you're on a ``category`` or custom route, for example.  
> **username_0**: No, I am not in the entry template.  I tried  using set to entry in craft.entries.section('posts'), but that just printed out the title of all the entries instead of the handful of options in the dropdown field.  
> **username_1**: That's your problem. Which post are you actually trying to get? When you call ``craft.entries`` you're going to get a group of entries back based on the parameters you specify. You might try something like ``{% set entry = craft.entries.section('posts').slug('post-with-isotope-options')[0] %}`` to get just one entry.  
> **username_0**: But I don't want the entries.  I just want to print the options in the field dropdown.  
> **username_1**: Gotcha, couple ways to do that, see answer below.  

---

## 1 answers

### Answer by username_1 on 2017-02-07. Score: 5 | Accepted answer

There's not an "elegant" way to do this but you can access the dropdown field by its handle using getFieldByHandle. Something like:
{% set dropdownField = craft.fields.getFieldbyHandle('isotope') %}

  {% for option in dropdownField.settings.options %}
    {{ option.value }}
  {% endfor %}

If you need the label instead, just use {{ option.label }}
You can also grab a dropdown's options from any entry you know has the field already attached, such as the first entry from your news section for example:
{% set entry = craft.entries.section('news').limit(1)[0] %}


{% for option in  entry.isotope.options %}
    {{ option.value }}
{% endfor %}


Note: similar to this question.

> **Comments:**
> **username_0**: Your first approach is just what I needed to print the field options into the isotope data-filter.  Thanks.  

---

