<p>The code above is correct, but it turns out there was an actual bug in the code if you had a number as the option value.</p>

<p>This affects Freeform 1.5.1 and earlier. The next version (1.5.2) of Freeform will include a fix for this. If anyone needs a patched copy of Freeform before 1.5.2 is available, just contact us via our <a href="https://solspace.com/craft/create-ticket/freeform" rel="nofollow noreferrer">support form</a>. :)</p>

CC BY-SA 3.0
2017-06-21T17:20:17.230Z
2017-06-21T17:20:17.230Z
Solspace
<p>On the form I'm building, I've got a question with radio buttons. And the answers have custom values. e.g.</p>

<p>Q: What is your favorite color?</p>

<ul>
<li>red (value: 10)</li>
<li>blue (value: 20)</li>
<li>yellow (value: 30) </li>
</ul>

<p>On my submissions page, I have the following code</p>

<pre><code>{% for field in submission.fieldMetadata %}
&lt;div class="row"&gt;
    &lt;div class="col-xs-3"&gt;
        &lt;b&gt;{{ field.label }}/b&gt;:
    &lt;/div&gt;
    &lt;div class="col-xs-9"&gt;
        {% set fieldValue = attribute(submission, field.handle).value %}
        {% if fieldValue is iterable %}
        &lt;ul&gt;
            {% for value in FieldValue %}
            &lt;li&gt;{{ value }}&lt;/li&gt;
            {% endfor %}
        &lt;/ul&gt;
        {% else %}
        {{ fieldValue }}
        {% endif %}
    &lt;/div&gt;
&lt;/div&gt;
{% endfor %}
</code></pre>

<p>And this returns:</p>

<p><em>What is your favorite color: 10</em></p>

<p>I'm using the values to do some funny math - so it's necessary (but unimportant to the issue at hand).</p>

<p>How to do I get the value "red" to show, instead of the 10?</p>

<p>attribute(submission, field.handle).value - shows the selected option's value (10)
<br>attribute(submission, field.handle).label - shows the question (What is your favorite Color?)
<br>attribute(submission, field.handle).handle - shows the question handle (whatIsYourFavoriteColor)</p>

<p>There should be another function to get the option's value, but I can't find what it is.</p>

<plugin-freeform><solspace>
Freeform - get option label & value on submissions page
# Freeform - get option label & value on submissions page

(Asked by: username_0 on 2017-06-15)

On the form I'm building, I've got a question with radio buttons. And the answers have custom values. e.g.
Q: What is your favorite color?

red (value: 10)
blue (value: 20)
yellow (value: 30) 

On my submissions page, I have the following code
{% for field in submission.fieldMetadata %}

    
        {{ field.label }}/b>:
    
    
        {% set fieldValue = attribute(submission, field.handle).value %}
        {% if fieldValue is iterable %}
        
            {% for value in FieldValue %}
            {{ value }}
            {% endfor %}
        
        {% else %}
        {{ fieldValue }}
        {% endif %}
    

{% endfor %}

And this returns:
What is your favorite color: 10
I'm using the values to do some funny math - so it's necessary (but unimportant to the issue at hand).
How to do I get the value "red" to show, instead of the 10?
attribute(submission, field.handle).value - shows the selected option's value (10)
attribute(submission, field.handle).label - shows the question (What is your favorite Color?)
attribute(submission, field.handle).handle - shows the question handle (whatIsYourFavoriteColor)
There should be another function to get the option's value, but I can't find what it is.

**Tags:** plugin-freeform, solspace

---

## 1 answers

### Answer by username_1 on 2017-06-21. Score: 1 | Accepted answer

The code above is correct, but it turns out there was an actual bug in the code if you had a number as the option value.

This affects Freeform 1.5.1 and earlier. The next version (1.5.2) of Freeform will include a fix for this. If anyone needs a patched copy of Freeform before 1.5.2 is available, just contact us via our [support form](https://solspace.com/craft/create-ticket/freeform). :)


---

