Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
Correctly Implementing selectMapping with Selectrix

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"));
                    }
                });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!