How to Submit Custom Values from a Dropdown Field

Follow

By default, a dropdown field submits the same text a visitor sees. If you need the stored value to differ from the label, for example showing "Middle School" but submitting "MS" so it maps to your CRM, you can remap the values with a short script.

This is community code, not an official Unbounce feature. Unbounce Support can't troubleshoot custom code. Test it on a published page before relying on it, and work with a developer if you aren't comfortable editing JavaScript.

Remap the submitted values

In the JavaScripts section, add the following with placement set to Before Body End Tag. Replace #gender with the ID of your dropdown, and pair each option label with the value you want submitted in its place:

<script>
jQuery(document).ready(function () {
  jQuery.each(jQuery('#gender')[0].options, function (i, option) {
    if (option.value === 'Doctor') { option.value = 44; }
    else if (option.value === 'Dentist') { option.value = 43; }
  });
});
</script>

To find the exact labels to match, publish the page and inspect the dropdown in your browser's developer tools. Unbounce generates the final page HTML at publish time, so the option values aren't available while you're editing.