I need to populate a drop-down list in a form with a list of Country Codes that can be obtained by calling CountryCode.getCountryCodes(), which returns a List. I am trying to use a JavaScript function to do this, but it doesn't seem to be working. I have included the code below. I am still new to JS, so please be kind.
<script language="JavaScript1.2">
import jblocks.data.CountryCode;
function loadCountryCodes() {
countryCodes = new Array(CountryCode.getCountryCodes().size());
for (i = 0; i < countryCodes.length; i++) {
countryCodes[i] = CountryCode.getCountryCodes().get(i);
}
document.Table2FORM.nationality.options = countryCodes;
}
</script>
...and right before the <form> tag...
<script language="JavaScript1.2">loadCountryCodes();</script>
Any help that can be offered would be much appreciated!
-Jen