Is it possible to assign a value that's different than the label displayed to the user? Specifically, I need to pass on some values to an API and they need to be in a specific format. For example, in a dropdown for form of payment, if the user selects Credit card then the value passed on to the API should be credit_card. I would prefer not to display the dropdown items like this, only pass the correct values.
The only way I can think of is with a variable and an if statement. If user selects Credit Card then the variable is set to credit_card and so on. However since there are like 10 options I was wondering if there's a better way than doing if, else if, else if... 10 times.