<p>The not so elegant way to do this is to re-use the field somewhere else, where you do have access to (e.g. a global set). But you probably want to avoid this, right?</p>

<p>What you can do instead is to access the field directly using <a href="http://buildwithcraft.com/docs/templating/craft.fields"><code>craft.fields</code></a>. This function returns the FieldModel of your field, containing all of its properties. The FieldModel property you want is <code>attributes.settings</code>, where you can access your dropdown <code>options</code> like this:</p>

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

{% for option in dropdownField.settings.options %}
    {{ option.value }}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2014-08-28T17:26:24.690Z
This worked perfectly, thank you. So glad there's a way to grab a field even when it's not part of the entry!
darylknight
CC BY-SA 3.0
2014-08-28T13:23:40.927Z
2014-08-28T13:23:40.927Z
carlcs
<p>I have a registration form on my website. All of the fields here so far have been text, which is no problem. However, I've just been asked to create a dropdown box for users to select their salutation (mr, mrs, doctor etc).</p>

<p>I've created the field in the backend and linked it to Users, and I can update it through a front-end form no problem using the value="users/saveUser" method, and pulling the values using currentUser.salutation.options. However, when registering, I can't output the values like that as the user isn't signed in (because they're registering), so there is no currentUser. I can't use the documentation code:</p>

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

<p>as there is no entry, I'm just on a template with a registration form on it. How do I output the dropdown options?</p>

<users><field><drop-down>
How do I output a dropdown's values if I'm on a registration form not tied to an entry?
# How do I output a dropdown's values if I'm on a registration form not tied to an entry?

(Asked by: username_0 on 2014-08-28)

I have a registration form on my website. All of the fields here so far have been text, which is no problem. However, I've just been asked to create a dropdown box for users to select their salutation (mr, mrs, doctor etc).
I've created the field in the backend and linked it to Users, and I can update it through a front-end form no problem using the value="users/saveUser" method, and pulling the values using currentUser.salutation.options. However, when registering, I can't output the values like that as the user isn't signed in (because they're registering), so there is no currentUser. I can't use the documentation code:
{% for option in entry.dropdownFieldHandle.options %}
    {{ option }}
{% endfor %}

as there is no entry, I'm just on a template with a registration form on it. How do I output the dropdown options?

**Tags:** users, field, drop-down


---

## 1 answers

### Answer by username_1 on 2014-08-28. Score: 11 | Accepted answer

The not so elegant way to do this is to re-use the field somewhere else, where you do have access to (e.g. a global set). But you probably want to avoid this, right?
What you can do instead is to access the field directly using craft.fields. This function returns the FieldModel of your field, containing all of its properties. The FieldModel property you want is attributes.settings, where you can access your dropdown options like this:
{% set dropdownField = craft.fields.getFieldbyHandle('dropdownFieldHandle') %}

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

> **Comments:**
> **username_0**: This worked perfectly, thank you. So glad there's a way to grab a field even when it's not part of the entry!  

---

