I am using some javascript code I found on LF Answers to create a dropdown in the state field of an address block. My problem is that the selection does not save with the form to the repository. I've seen that this is a problem when using a read only field, but my field is not read only. I'm setting the country with with javascript and it is saving, but not the state. Here is a snip of the code I'm using:
$(document).ready (function () {
$(".Country").parent().children().val("USA");
$(".State").attr("maxlength", 2);
$('.State').replaceWith('<select name="State" class="form-item-field State" vo="e"> ' +
'<option></option>' +
'<option value=""></option>' +
'<option value="AL">AL</option>' +
'<option value="AK">AK</option>' +
'<option value="AR">AR</option>' +
'<option value="AZ">AZ</option>' +
'<option value="CA">CA</option>' +
'<option value="CO">CO</option>' +
'<option value="CT">CT</option>' +
'<option value="DC">DC</option>' +
'</select>');
$(".State").parent().children().val();
});
Any help is appreciated