I have this code that will pull the values of a checkbox or radio from the fields in Craft CMS, do be used and selected by a user on a front end form.

    {% for checkboxOption in currentUser.fieldHandle.options %}
        {% set checked = false %}

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

            <input type="radio" value="{{ checkboxOption.value }}" name="fields[fieldHandle]" {% if checked %} checked="checked" {% endif %}><span>{{ checkboxOption.label }}</span>
    {% endfor %}

How do I do the same for a dropdown list?

1 Answer 1


You'd do something very similar:

<select name="fields[fieldHandle]">

    {% for dropdownOption in currentUser.fieldHandle.options %}
        <option value="{{ dropdownOption.value }}"{% if option.selected %} selected{% endif %}>{{ dropdownOption.label }}</option>
    {% endfor %}

  • Brad, thanks for your help. This worked, and encouraging to know I wasn't far off when I had! Sep 13, 2017 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.