The Map ID serves as a crucial value for the successful loading of advanced markers. While we can validate whether the value is blank, we face a challenge when the Map ID provided is invalid. In such cases, how to make sure the map id is invalid prior to attempting to load the map?
Reference link for advanced markers
Going through the above link, Map ID is required to load Google map. If I provide invalid value how to validate before google map load.
We trying to validate Map ID using below code. is there any other way to validate Map ID? Please share your ideas.
Ext.Ajax.request({
url: 'https://maps.googleapis.com/maps/api/mapsjs/mapConfigs:batchGet?map_ids='+vFldValues['install_gmapid'],
method: 'GET',
disableCaching: false,
success: function(response) {
vResponseData = Ext.decode(response.responseText);
vMapApiConfig = vResponseData.mapsApiConfigs[0];
vMapParamSet = vMapApiConfig.mapParamSet;
vTierValidation = vMapParamSet.tierValidationStatus;
if (vResponseData && vMapApiConfig && vMapParamSet && vTierValidation && vTierValidation[0].code === 'STATUS_MAP_ID_NOT_FOUND') {
alert('MSG_ERR_JS_INAVLID_GAPIKEY_GMAPID');
return;
} else {
vContainer.add(me.hdr_gmap);
me.hdr_fetchFilteredData(vFormPanel);
}
},
failure: function(response) {
var vResponseData = Ext.decode(response.responseText);
if (vResponseData && vResponseData.error.code === 400) {
alert('MSG_ERR_JS_INAVLID_GAPIKEY_GMAPID');
return;
}
}
});
After loading the google maps js file with the credentials, you can get the validity of advancedMarkers like this: