Quick question, struggling with the Selectric implementation on our Autofill function...
can someone give me a quick pointer on how the correct syntax looks like?
var select = document.getElementById("selectAddress"),
street = document.getElementById("streetInput"),
city = document.getElementById("cityInput"),
postal = document.getElementById("postalInput"),
state = document.getElementById("stateInput");
country = document.getElementById("countryInput")
language = document.getElementById("language")
apiForm = document.getElementById("apiform")
console.log(apiForm)
var mapping = {
"1": { 'sampleStreet': "Heilsbronner Strasse 4", 'sampleCity': "Neuendettelsau", 'samplePostal': "91564", 'sampleState': "Bayern", 'sampleCountry': "de" },
"2": { 'sampleStreet': "1600 Pennsylvania Avenue", 'sampleCity': "Washington", 'samplePostal': "20500", 'sampleState': "Washington D.C.", 'sampleCountry': "us" },
"3": { 'sampleStreet': "Champ de Mars 5 Av. Anatole", 'sampleCity': "Paris", 'samplePostal': "75007", 'sampleState': "Paris", 'sampleCountry': "fr" },
"4": { 'sampleStreet': "1 Queen's Rd W", 'sampleCity': "Hong Kong", 'samplePostal': "Neuendettelsau", 'sampleState': "Hong Kong", 'sampleCountry': "hk" },
};
select.addEventListener("change", function () {
var selectedMapping = mapping[select.value];
if (selectedMapping) {
street.value = selectedMapping.sampleStreet;
city.value = selectedMapping.sampleCity;
postal.value = selectedMapping.samplePostal;
state.value = selectedMapping.sampleState;
$(country.value(selectedMapping.sampleCountry)).selectric("refresh");
} else {
street.value =
city.value =
postal.value =
state.value =
postal.value = null
$(country.val(null).selectric("refresh"));
}
});