<p>The LJ Dynamic fieldtype only stores the value as a string, or as an array of values for the multiselect fieldtypes. The label in the settings is there just for displaying in the admin.</p>

<p>Either you could use the store.title instead of store.storeId as the value, if you only need the store name in your template. Or you could use the store id to get the data from the store in your template. Something like:</p>

<pre><code>{% set store = craft.entries.section('stores').storeId(entry.stores).first() %}
{{ store.title }}
</code></pre>

CC BY-SA 3.0
2015-09-17T13:21:26.840Z
2015-09-17T18:24:52.320Z
2015-09-17T18:24:52.320Z
André Elvan
<p>I have a LJ Dynamic field set up with the following code that pulls in a list of stores to an event section. </p>

<pre><code>{% for store in craft.entries.section('stores').order('title') %}
  { "value":"{{ store.storeId }}" , "label":"{{ store.title | raw}}"}
  {% if not loop.last %},{% endif %}
{% endfor %}
</code></pre>

<p>My problem is that I can't seem to get the label from the field to display on the front end as I keep getting the error message 
"Impossible to access an attribute ("label") on a string variable ("412")" 412 is the value of the particular store I have selected for my event.</p>

<pre><code>&lt;p class="location"&gt;&lt;strong&gt;Where:&lt;/strong&gt; {{ entry.stores.label }}&lt;/p&gt;
</code></pre>

<p>If I add just <code>{ entry.stores }</code> it will output the value.</p>

<p>This is probably something very obvious but got me a bit stuck. </p>

<label>
How do I grab the label of a LJ Dynamic dropdown fields
# How do I grab the label of a LJ Dynamic dropdown fields

(Asked by: username_0 on 2015-09-17)

I have a LJ Dynamic field set up with the following code that pulls in a list of stores to an event section. 
{% for store in craft.entries.section('stores').order('title') %}
  { "value":"{{ store.storeId }}" , "label":"{{ store.title | raw}}"}
  {% if not loop.last %},{% endif %}
{% endfor %}

My problem is that I can't seem to get the label from the field to display on the front end as I keep getting the error message 
"Impossible to access an attribute ("label") on a string variable ("412")" 412 is the value of the particular store I have selected for my event.
Where: {{ entry.stores.label }}

If I add just { entry.stores } it will output the value.
This is probably something very obvious but got me a bit stuck.

**Tags:** label


---

## 1 answers

### Answer by username_1 on 2015-09-17. Score: 2 | Accepted answer

The LJ Dynamic fieldtype only stores the value as a string, or as an array of values for the multiselect fieldtypes. The label in the settings is there just for displaying in the admin.
Either you could use the store.title instead of store.storeId as the value, if you only need the store name in your template. Or you could use the store id to get the data from the store in your template. Something like:
{% set store = craft.entries.section('stores').storeId(entry.stores).first() %}
{{ store.title }}


---

