Googleマップを使用してASPテキストボックスのオートコンプリート機能を使用しています.ボタンをクリックするか、ドロップダウンリスト項目を選択すると[ポストバック]エラーが発生します
不明なエラー。行: 20 文字: 207 コード: 0 URI: maps.gstatic.com/cat_js/intl/en_us/mapfiles/api-3/13/8/…
通常の負荷では正常に動作しています。
function CallInitialiseInPost() {
initialize();
}
var prm = window.Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(CallInitialiseInPost);
function initialize() {
var input = document.getElementById('<%=txtStreetAddress.ClientID%>');
var autocomplete = new google.maps.places.Autocomplete(input);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
var place = autocomplete.getPlace();
var hiddenCity = document.getElementById('<%=cityHidden.ClientID%>');
var hiddenPostal = document.getElementById('<%=postalHidden.ClientID%>');
var hiddenstreetSelected = document.getElementById('<%=streetSelectedHidden.ClientID%>');
if (place.address_components) {
for (var i = 0; i < place.address_components.length; i++) {
var addr = place.address_components[i];
var getCity;
var getPostal;
var getStreet;
hiddenstreetSelected.value = "streetselected";
if (addr.types[0] == 'locality') {
getCity = addr.long_name;
hiddenCity.value = "cityfilled";
document.getElementById('<%=txtCity.ClientID%>').value = getCity;
}
if (addr.types[0] == 'postal_code') {
getPostal = addr.long_name;
hiddenPostal.value = "postalfilled";
if (getPostal.length < 6) {
alert("The complete postal code could not be resolved by Google Maps, please ask the patient for their postal code, and manually enter this into the Postal Code field.");
}
else {
document.getElementById('<%=txtPostal.ClientID%>').value = getPostal;
}
}
if (addr.types[0] != 'postal_code') {
document.getElementById('<%=txtPostal.ClientID%>').value = "";
}
if (hiddenCity.value == "" && addr.types[0] != 'locality') {
document.getElementById('<%=txtCity.ClientID%>').value = "";
}
}
if (hiddenPostal.value == "") {
alert("The complete postal code could not be resolved by Google Maps, please ask the patient for their postal code, and manually enter this into the Postal Code field.");
}
hiddenCity.value = "";
hiddenPostal.value = "";
input.style.color = "Black";
document.getElementById('<%=txtSuite.ClientID%>').select();
document.getElementById('<%=txtSuite.ClientID%>').focus();
setTimeout(SaveStreet, 10);
setTimeout(clickOnTabButton, 10);
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);