<p>If you need to get the options independent of any specific entry, you can use the <a href="https://docs.craftcms.com/api/v4/craft-services-fields.html" rel="nofollow noreferrer">fields service</a> to get the field and retrieve its options.</p>
<pre class="lang-twig prettyprint-override"><code>{% set field = craft.app.fields.getFieldByHandle('myFieldHandle') %}
{% for option in field.options %}`
</code></pre>
<p>In this case, <code>option</code> will be an array with the keys <code>value</code>, <code>label</code> and <code>default</code> (this will be <code>'1'</code> if the option is the default, or an empty string).</p>

CC BY-SA 4.0
2022-11-11T08:33:11.920Z
2022-11-11T08:33:11.920Z
MoritzLost
<p>I know how to get a list of selected checkboxes for a entry:</p>
<pre><code>{% for option in entry.myFieldHandle.options %}
  Label: {{ option.label }}
  Value: {{ option }} or {{ option.value }}
{% endfor %}
</code></pre>
<p>But I can't figure out how to simply display a list of available checkboxes of a certain field in the template. This may be needed if I want, for example, to create a form for adding a entry. Is there such a construction?</p>

<craft3>
How do I get a list of checkboxes for the item addition form?
# How do I get a list of checkboxes for the item addition form?

(Asked by: username_0 on 2022-11-11)

I know how to get a list of selected checkboxes for a entry:
{% for option in entry.myFieldHandle.options %}
  Label: {{ option.label }}
  Value: {{ option }} or {{ option.value }}
{% endfor %}

But I can't figure out how to simply display a list of available checkboxes of a certain field in the template. This may be needed if I want, for example, to create a form for adding a entry. Is there such a construction?

**Tags:** craft3

---

## 1 answers

### Answer by username_1 on 2022-11-11. Score: 1 | Accepted answer

If you need to get the options independent of any specific entry, you can use the fields service to get the field and retrieve its options.
{% set field = craft.app.fields.getFieldByHandle('myFieldHandle') %}
{% for option in field.options %}`

In this case, option will be an array with the keys value, label and default (this will be '1' if the option is the default, or an empty string).


---

