I have a drop-down field in the CP - It represents a range of numbers that are based either a percent or a fixed number.

For example, a choice could be Fixed 5% or a choice could be Variable 5% In either case, the value of my field is 5.00 for both options. The label is different, one says "Fixed" the other says "Variable".

It seems that this is a bad approach as I will usually get the first match based on value.

Let's say I have Fixed 5% listed first in my drop down field, but I actually choose Variable 5%. Currently, I am getting Fixed 5% as the selected option instead of Variable 5%.

I'm not sure how I can set up this field correctly so that Craft can see what I have chosen correctly. Perhaps there is a better way to setting up my drop down?

1 Answer 1


Craft saves only the option value of a field, not the option description. After saving and editing again, it loops trough all the option values and compare it with the saved value. If it matchs it selects the first option.

You always need to have unique values. For example you can use 5fix and 5var as option values. If you need different outputs in your frontend template, you can use a switch case like this (code is untested, but should work):

{% switch entry.field %}
  {% case "5fix" %}
    Fixed 5%
  {% case "5var" %}
    Variable 5% 
{% endswitch %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.