Skip to content
This repository was archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:newism/craft3-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
leevigraham committed Jul 21, 2020
2 parents f307ede + 8781831 commit 98ce315
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/assetbundles/addressfield/dist/js/Address.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,23 @@
initAutocomplete: function () {
this.$autoCompleteInput = this.$element.find('#'+this.options.namespace+'-autoComplete');

this.autocomplete = new google.maps.places.Autocomplete(
this.$autoCompleteInput[0],
this.options.fieldSettings.autoCompleteConfiguration
);

google.maps.event.addDomListener(this.$autoCompleteInput[0], 'keydown', function(e) {
if (e.keyCode === 13) {
e.preventDefault();
}
});
if(this.$autoCompleteInput.length){

this.autocomplete = new google.maps.places.Autocomplete(
this.$autoCompleteInput[0],
this.options.fieldSettings.autoCompleteConfiguration
);

// When the user selects an address from the dropdown, populate the address
// fields in the form.
this.autocomplete.addListener('place_changed', $.proxy(this.placeChanged, this));
google.maps.event.addDomListener(this.$autoCompleteInput[0], 'keydown', function(e) {
if (e.keyCode === 13) {
e.preventDefault();
}
});

// When the user selects an address from the dropdown, populate the address
// fields in the form.
this.autocomplete.addListener('place_changed', $.proxy(this.placeChanged, this));
}
},

refreshCountry: function () {
Expand Down

0 comments on commit 98ce315

Please sign in to comment.