<p>You can pull the field directly using <a href="http://buildwithcraft.com/docs/templating/craft.fields" rel="nofollow"><code>craft.fields</code></a>:</p>

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

<p>The options will be available under the field's <code>settings.options</code> property. Each option will have attributes for <code>value</code> and <code>label</code>:</p>

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

CC BY-SA 3.0
2015-06-18T07:49:39.077Z
2015-06-18T07:49:39.077Z
Mats Mikkel Rummelhoff
<p>How would I get a list of all the checkbox options associated with a specific field, without having an entry to loop over? I'm using the same form for creating new entries and editing existing ones. Been using <em>{{ entry.fieldValue | default( ) }}</em> for almost everything else.</p>

<pre><code>{% if entry is defined and entry.id is not empty %}
    {% for option in entry.myFieldOptions.options %}
        &lt;div class="checkbox"&gt;
            {% set checked = false %}

            {% if option.selected %}
                {% set checked = true %}
            {% endif %}

            {% if not checked %}
                &lt;input type="hidden" name="fields[myFieldOptions][]" value=""&gt;
            {% endif %}

            &lt;input type="checkbox" value="{{ option.value }}" name="fields[myFieldOptions][]" {% if option.selected %} checked="checked"{% endif %}&gt;{{ option.label }}
        &lt;/div&gt;
    {% endfor %}
{% else %}
    //hardcoded values
    //is there a way to reference available checkbox options directly?
{% endif %}
</code></pre>

<templating><entry><fieldtypes><checkboxes>
Getting checkbox options for a new entry, without having an entry
# Getting checkbox options for a new entry, without having an entry

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

How would I get a list of all the checkbox options associated with a specific field, without having an entry to loop over? I'm using the same form for creating new entries and editing existing ones. Been using {{ entry.fieldValue | default( ) }} for almost everything else.
{% if entry is defined and entry.id is not empty %}
    {% for option in entry.myFieldOptions.options %}
        
            {% set checked = false %}

            {% if option.selected %}
                {% set checked = true %}
            {% endif %}

            {% if not checked %}
                
            {% endif %}

            {{ option.label }}
        
    {% endfor %}
{% else %}
    //hardcoded values
    //is there a way to reference available checkbox options directly?
{% endif %}

**Tags:** templating, entry, fieldtypes, checkboxes


---

## 1 answers

### Answer by username_1 on 2015-06-18. Score: 4 | Accepted answer

You can pull the field directly using craft.fields:
{% set myFieldOptions = craft.fields.getFieldbyHandle('myFieldOptions') %}

The options will be available under the field's settings.options property. Each option will have attributes for value and label:
{% for option in myFieldOptions.settings.options %}
    {{ option.label }} {{ option.value }}
{% endfor %}


---

