diff --git a/js/geofield_map_widget.js b/js/geofield_map_widget.js index 3b9c6e93..66e0e669 100644 --- a/js/geofield_map_widget.js +++ b/js/geofield_map_widget.js @@ -657,9 +657,14 @@ self.map_data[params.mapid].search.keydown(function (e) { if (e.which === 13) { e.preventDefault(); + // With the Geocoder module integration, address lookup is handled + // by its own autocomplete; only the Google Geocoder applies here. + if (!self.geocoder || self.map_data[params.mapid].gmap_geocoder === 1) { + return; + } let input = self.map_data[params.mapid].search.val(); // Execute the geocoder. - Drupal.geoFieldMapGeocoder.geocode({address: input}, function (results, status) { + self.geocoder.geocode({address: input}, function (results, status) { if (status === google.maps.GeocoderStatus.OK && results[0]) { // Triggers the Geocode on the Geofield Map Widget. let position = self.getLatLng(params.mapid, results[0].geometry.location.lat(), results[0].geometry.location.lng());