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 %}
<div class="row">
<div class="col-xs-3">
<b>{{ field.label }}/b>:
</div>
<div class="col-xs-9">
{% set fieldValue = attribute(submission, field.handle).value %}
{% if fieldValue is iterable %}
<ul>
{% for value in FieldValue %}
<li>{{ value }}</li>
{% endfor %}
</ul>
{% else %}
{{ fieldValue }}
{% endif %}
</div>
</div>
{% 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.