<p>The values in your <code>tagsMultiSelect</code> are the tag ids, not the tags.
So, what you need to do in your template is convert that id to a tag:</p>

<pre><code>{% for tagId in entry.tagsMultiSelect %}
  {# get the tag with that id #}
  {% set tag = craft.tags.id(tagId).first %}

  &lt;a href=""&gt;{{ tag.title ?? 'no such tag' }}&lt;/a&gt;
  {% if not loop.last %}, {% endif %}
{% endfor %}
</code></pre>

<hr>

<p>If what you want is a predefined set of tags, you might also consider changing that tag group into a category - that would let you use a regular category field for your <code>tagsMultiSelect</code>.</p>

CC BY-SA 3.0
2017-10-02T14:55:11.093Z
2017-10-02T14:55:11.093Z
Marion Newlevant
<p>I’m using the <a href="https://github.com/lewisjenkins/craft-lj-dynamicfields" rel="nofollow noreferrer">LJ Dynamic Fields</a> plugin and have a dynamic multi select setup for the client to select predefined tags, which is working all fine in the cms using the following code.</p>

<pre><code>{% for tags in craft.tags.group('default').limit(null).order('title') %}
{ "value":"{{ tags.id }}" , "label":"{{ tags | raw | capitalize }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
</code></pre>

<p>However, in my template I can only seem to output the id, but I want the tag title. I’m using the following code in my template:</p>

<pre><code>{% for tags in entry.tagsMultiSelect %}
&lt;a href=""&gt;{{ tags }}&lt;/a&gt;
{% if not loop.last %}, {% endif %}
{% endfor %}
</code></pre>

<p>Can anyone tell me where I’m going wrong?</p>

<templating>
LJ Dynamic Fields unable to output title
# LJ Dynamic Fields unable to output title

(Asked by: username_0 on 2017-10-01)

I’m using the LJ Dynamic Fields plugin and have a dynamic multi select setup for the client to select predefined tags, which is working all fine in the cms using the following code.
{% for tags in craft.tags.group('default').limit(null).order('title') %}
{ "value":"{{ tags.id }}" , "label":"{{ tags | raw | capitalize }}"
}{% if not loop.last %},{% endif %}
{% endfor %}

However, in my template I can only seem to output the id, but I want the tag title. I’m using the following code in my template:
{% for tags in entry.tagsMultiSelect %}
{{ tags }}
{% if not loop.last %}, {% endif %}
{% endfor %}

Can anyone tell me where I’m going wrong?

**Tags:** templating

---

## 1 answers

### Answer by username_1 on 2017-10-02. Score: 3 | Accepted answer

The values in your tagsMultiSelect are the tag ids, not the tags.
So, what you need to do in your template is convert that id to a tag:
{% for tagId in entry.tagsMultiSelect %}
  {# get the tag with that id #}
  {% set tag = craft.tags.id(tagId).first %}

  {{ tag.title ?? 'no such tag' }}
  {% if not loop.last %}, {% endif %}
{% endfor %}


If what you want is a predefined set of tags, you might also consider changing that tag group into a category - that would let you use a regular category field for your tagsMultiSelect.


---

