0
我試圖使用加拿大郵政Address Complete我的表格上這樣加拿大郵政AddressComplete「填充」不工作
var fields = [
{ element: "street_address", field: "Line1" },
{ element: "city_address", field: "City", mode: pca.fieldMode.POPULATE },
{ element: "postal_code", field: "PostalCode", mode: pca.fieldMode.POPULATE },
{ element: "country", field: "CountryName", mode: pca.fieldMode.COUNTRY }
],
options = {key: KEY},
control = new pca.Address(fields, options);
addressComplete.listen('load', function(control) {
control.listen("populate", function (address) {
if(address.ProvinceCode == "ON"){
console.log("ONTARIO");
document.getElementById('province').selectedIndex = 2;
}
else if(address.ProvinceCode == "QC"){
document.getElementById('province').selectedIndex = 3;
}
});
});
我能搜索地址,並有一些領域的自動填入。我的表單上的省是一個下拉列表,我想按照網站中的建議使用監聽器,但它不起作用?有人能讓我知道我做錯了什麼嗎?
你是對的!謝謝 :) – ultimatecoder