Follow

Preference Site State Form Selection List

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:

 
$(document).ready(function() {
            init();
            populateStates('state', 'Select a State');
});

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 subscriber has already selected, change 'Select a State' to '${state}'. If the subscriber has no State set, then the option will appear blank by default followed by the additional options to select.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk