地理数据解决方案下拉生成器的问题
Problem with Geodata solutions dropdown generator
我正在使用地理数据解决方案下拉列表生成器来获取世界上所有国家、州和城市的列表。它是这样工作的:select 国家 -> 该国的所有州都出现在州列表中 -> select 个州 -> 该州的所有城市都出现在城市列表中 -> select 城市。
当我尝试手动 select 一个国家时,其他州列表根本不会更新 selected 国家的所有州,它仍然是空白的。
https://geodata.solutions/?chronoform=listbuilder&event=submit
我的代码用于手动 selecting 列表中的项目:
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;
}
如果您能帮助找到手动 select 项目以便其他列表正确更新的方法,我们将不胜感激。
设法找到答案。
发生的事情是,当通过 javacript 设置列表的值时,jquery onChange() 方法不会激活。
为了解决这个问题,您需要做的就是使用 jquery 设置值并将其链接到 .Change() 方法
我正在使用地理数据解决方案下拉列表生成器来获取世界上所有国家、州和城市的列表。它是这样工作的:select 国家 -> 该国的所有州都出现在州列表中 -> select 个州 -> 该州的所有城市都出现在城市列表中 -> select 城市。 当我尝试手动 select 一个国家时,其他州列表根本不会更新 selected 国家的所有州,它仍然是空白的。 https://geodata.solutions/?chronoform=listbuilder&event=submit
我的代码用于手动 selecting 列表中的项目:
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;
}
如果您能帮助找到手动 select 项目以便其他列表正确更新的方法,我们将不胜感激。
设法找到答案。 发生的事情是,当通过 javacript 设置列表的值时,jquery onChange() 方法不会激活。 为了解决这个问题,您需要做的就是使用 jquery 设置值并将其链接到 .Change() 方法