Get selected values from all of an entry’s Multi-select fields I am new in Craft, and will be happy if I can get help with this task. I have a tab that contains only multiselect fields. What I want to do, is to get all selected values for all multiselects field in this tab. I find this answer to get all field from a tab, but I can't get the selected values for the entry. Here is my code:

{% for tab in entry.getFieldLayout().getTabs() %}
  {% if tab.name == 'Spec' %}
    &lt;ul&gt;
      &lt;li&gt;{{ tab.name }}
        &lt;ul&gt;
          {% for field in tab.getFields() %}
            &lt;li&gt;{{ field.getField().name }}&lt;/li&gt;
          {% endfor %}
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  {% endif %}
{% endfor %}
You can loop through all of the selected values of a multi-select field like this:



{% for value in entry.myFieldHandle %}
  &lt;li&gt;{{ value }}&lt;/li&gt;
{% endfor %}


(See the Multi-select field docs for other examples.)

The easiest way to loop through all of your multi-select fields’ values would be to manually merge all of their values into a new array:

{% set values = entry.fieldHandleOne
    |merge([entry.fieldHandleTwo])
    |merge([entry.fieldHandleThree]) %}

{% for value in values %}
    {{ value }}
{% endfor %}


If you really don’t want to hardcode the field handles in your template, then you can go the getFieldLayout() route. That field.getField() function will give you the actual FieldModel that represents the field. You can use its handle property to access the field’s selected values on your entry:

{% set values = [] %}

{% for tab in entry.getFieldLayout().getTabs() %}
  {% if tab.name == 'Spec' %}
    {% for field in tab.getFields() %}
      {% set handle = field.getField().handle %}
      {% set fieldValues = entry.getFieldValue(handle) %}
      {% set values = values|merge([fieldValues]) %}
    {% endfor %}
  {% endif %}
{% endfor %}

{% for value in values %}
  {% for selected in value %}
    &lt;li&gt;{{ selected}}&lt;/li&gt;
  {% endfor %}
{% endfor %}