Answered

How can I set option labels and values independently in a dropdown field?


I have a form that lists all countries worldwide (≅200) in a dropdown field. The option label seen by the user needs to be the name of the country, but the submitted value needs to be an integer.

I’m wondering if there is an option to do this with Typeform. I’m really curious that I don't find any information about this, since this is a standard specification in HTML.

  <label for="cars">Choose a car:</label>
<select id="cars" name="cars">
<option value="volvo">Volvo XC90</option>
<option value="saab">Saab 95</option>
<option value="mercedes">Mercedes SLK</option>
<option value="audi">Audi TT</option>
</select>

 

icon

Best answer by john.desborough 20 May 2022, 19:09

View original

3 replies

Userlevel 7
Badge +5

Hi @webserviceXXL Happy Friday! I hope you’re excited for the weekend! 😀

 We don’t have an option for this within our forms, but possible @mathio or @picsoung know of a workaround outside of typeform!

Userlevel 7
Badge +6

@webserviceXXL - the only way to work around this in ‘native typeform’ would be to create a series of logic rules that assigned the numeric value you want to the country chosen in the list.. something like this:

  • if q2 = Canada then set v_country_code = 3

where v_country_code is a variable you create in the Advanced Logic area. 

you could then use the variable elsewhere in your logic. 

yes, it’s not perfect match to what you want and yes, it seems like a lot of logic rules to create for the form BUT once it’s done, it works just fine.. I did it for a 60 industry drop down for one project - and i created a single question typeform holding all that logic so that any time i need to create a new quiz with that list and logic in it, i can duplicate this form and then add other questions around it .. 

just sayin’

des

@john.desborough Thanks for the feedback and the explanation. This workaround feels quite adventurous and too effortful. Especially with such a cost-intensive solution like Typeform. We already canceled our plan and switched to another solution. But good to know that there is a workaround, I will keep in mind. Thank you!

Reply