<p>You'll likely want to do something like this:</p>

<pre><code>{% for fieldtype in blocktype.getFieldLayout.fields %}
    {% set field = fieldtype.field %}

    Handle: {{ field.handle }}

    {% if field.type == 'Dropdown' %}
        {% for option in field.settings.options %}
            Label: {{ option.label }}
            Value: {{ option.value }}
        {% endfor %}
    {% endif %}
{% endfor %}
</code></pre>

<p>Essentially, this loops through all the sub-fields in your Super Table field, and for each field, you can make any sort of conditional you like in order to handle each fields content.</p>

CC BY-SA 3.0
2017-05-15T04:01:23.717Z
Exactly the shove I needed. `{% if field.type == 'Dropdown' %}` was it. Thank you!
Damon
CC BY-SA 3.0
2017-05-14T21:52:19.813Z
2017-05-14T21:52:19.813Z
crawf
<p>I a musing a front-end form to create an entry in the CP. In my form I am using a <a href="https://github.com/engram-design/SuperTable" rel="nofollow noreferrer">SuperTable</a> that contains two fields/blocks.</p>

<ul>
<li>Size - [text input]</li>
<li>Measurement - [dropdown]</li>
</ul>

<p>Here is what my template looks like:</p>

<pre><code>&lt;div class="row"&gt;
    &lt;input type="hidden" name="fields[lotSize]"&gt;
    &lt;input type="hidden" name="fields[lotSize][new1][type]" value="1"&gt;

    &lt;div class="col-xs-6"&gt;
        &lt;div class="form-group"&gt;
            &lt;label for="lotSize"&gt;Lot Size&lt;/label&gt;
            &lt;input type="text" class="form-control" name="fields[lotSize][new1][fields][size]"&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="col-xs-6"&gt;
        &lt;label for="measurement"&gt;Measurement&lt;/label&gt;
        &lt;select name="fields[lotSize][new1][fields][measurement]"&gt;
            {# Loop through the values instead of hard-coding #}
            &lt;option value=""&gt;Select&lt;/option&gt;
            &lt;option value="squareFeet"&gt;Square Feet&lt;/option&gt;
            &lt;option value="acres"&gt;Acres&lt;/option&gt;
        &lt;/select&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>I've been reading through <a href="https://github.com/engram-design/SuperTable/wiki/Updating-a-Super-Table-field-from-a-front-end-form" rel="nofollow noreferrer">Updating a Super Table field from a front end form</a> and have tried this:</p>

<pre><code>{% set fieldHandle = 'lotSize' %}
{% set field = craft.fields.getFieldByHandle(fieldHandle) %}
{% set blocktype = craft.superTable.getSuperTableBlocks(field.id)[0] %}
</code></pre>

<p>...But I'm not sure where to go next to get to the <code>measurement</code> field.</p>

<p>I have attached a screenshot of my CP page to help show what I am trying to accomplish. Thank you for any suggestions!</p>

<p><a href="https://i.sstatic.net/Ly6DZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Ly6DZ.png" alt="enter image description here"></a></p>

<templating><plugin-supertable>
How can I loop through the values of a drop down within a SuperTable?
# How can I loop through the values of a drop down within a SuperTable?

(Asked by: username_0 on 2017-05-14)

I a musing a front-end form to create an entry in the CP. In my form I am using a SuperTable that contains two fields/blocks.

Size - [text input]
Measurement - [dropdown]

Here is what my template looks like:

    
    

    
        
            Lot Size
            
        
    
    
        Measurement
        
            {# Loop through the values instead of hard-coding #}
            Select
            Square Feet
            Acres
        
    


I've been reading through Updating a Super Table field from a front end form and have tried this:
{% set fieldHandle = 'lotSize' %}
{% set field = craft.fields.getFieldByHandle(fieldHandle) %}
{% set blocktype = craft.superTable.getSuperTableBlocks(field.id)[0] %}

...But I'm not sure where to go next to get to the measurement field.
I have attached a screenshot of my CP page to help show what I am trying to accomplish. Thank you for any suggestions!

**Tags:** templating, plugin-supertable

---

## 1 answers

### Answer by username_1 on 2017-05-14. Score: 3 | Accepted answer

You'll likely want to do something like this:
{% for fieldtype in blocktype.getFieldLayout.fields %}
    {% set field = fieldtype.field %}

    Handle: {{ field.handle }}

    {% if field.type == 'Dropdown' %}
        {% for option in field.settings.options %}
            Label: {{ option.label }}
            Value: {{ option.value }}
        {% endfor %}
    {% endif %}
{% endfor %}

Essentially, this loops through all the sub-fields in your Super Table field, and for each field, you can make any sort of conditional you like in order to handle each fields content.

> **Comments:**
> **username_0**: Exactly the shove I needed. `{% if field.type == 'Dropdown' %}` was it. Thank you!  

---

