Question
How do I populate the State form selection list in my Preference Site with the State names?
Answer
When you insert the State Form Selection List it will initially be empty. You can automatically populate the selection list by adding code to the page. The pref_site.js is required for this to work and is included by default when you create a page.
To populate the selection list, you must add a line of code in the <script> portion of the HTML Head. Below the init(); line in the $(document).ready() function, add:
populateStates('state', 'Select a State');
To make the function appear as:
The first parameter in the command is the <select> id, and the second parameter is the default item that will appear at the top of the list. You can change the word 'Select a State' to your own label, such as 'Choose Your State'.
To display the State the contact has already selected, change 'Select a State' to '${state}'. If the contact has no State set, then the option will appear blank by default followed by the additional options to select.