Skip navigation

Do It

1 Post authored by: Jem Janik

We use a picklist for our country drop downs in forms where the value matches the country code in SFDC.  It's a ugly string of characters that gives you no clue what the country value is when you see a notification email.

I am personally not great with javascript, but I've managed to get the country display value added to a hidden field so it is sent in the notification email with lots of googling.  To save you from googling here is the javascript:

 

//set value of hidden field from drop down list display text
function ddlselect () {

//set d to the drop down list
 var d = document.getElementById("fe44703");

//grab the display text of the selected item
 var displaytext=d.options[d.selectedIndex].text;

//set the value of the hidden field
document.getElementById("fe44715").value=displaytext;
}

window.onload = function() {document.getElementById("fe44703").addEventListener("change", ddlselect);}

 

In your form HTML you will be able to find the id values for your drop down list and hidden field.  In this example my drop down list is fe44703 and my hidden field is fe44715.  (Note: getElementByName is deprecated in HTML5).

Filter Blog

By date: By tag: