Problem with Geodata solutions dropdown generator

Viewed 359

I am using the Geodata solutions dropdown generator in order to get a list of all countries, states ans cities in the world. it works like this: select country -> all states in the country appear in states list -> select states -> all cities in state appear in cities list -> select city. When i try to manually select a country, the other states list simply doesn't update with all the states in the selected country, and it remains blank. https://geodata.solutions/?chronoform=listbuilder&event=submit

my code for manually selecting an item in the lists:

function fillCities()
        {

            setTimeout(fillCountry, 5000);

            setTimeout(fillDistrict, 10000);

            setTimeout(fillCity, 15000);


        }
        function fillCountry() {
            var countryValue = document.getElementById('<% =countryValue.ClientID %>').value;
            var country = document.getElementById('countryId');

            country.value = countryValue;
        }
        function fillDistrict() {
            var districtName = document.getElementById('<% =stateValue.ClientID %>').value;
            var district = document.getElementById("stateId")
            district.value = districtName;
        }
        function fillCity() {
            var cityName = document.getElementById('<% =cityValue.ClientID %>').value;
            var city = document.getElementById("cityId")
            city.value = cityName;
        }

would gladly appreciate any help in finding a way to manually select an item so that the other lists update correctly.

1 Answers

Managed to find an answer. what happened is that when setting the value of the lists through javacript, the jquery onChange() method doesnt activate. All you need to do in order to fix the problem is to set the values using jquery and chaining to it the .Change() method

Related