Now disabling the address autocomplete after displaying city, state, and zip

This commit is contained in:
Leah Schumann 2022-05-18 08:02:07 -04:00
parent ccf6d59481
commit 7dc7531533
2 changed files with 13 additions and 4 deletions

View file

@ -297,8 +297,10 @@ export default {
// if multiple cars were found
let matchingCars = carsFound.filter(car => car.vehicle.carId === carEntered.carId);
if (matchingCars.length === 1) {
// and one and only of them matches the car id entered
this.$refs.loadingModal.showModal();
// and one and only of them matches the car id entered
const matchingCar = matchingCars[0];
this.updateVehicleInfo(matchingCar.vin, matchingCar.vehicle);
navigateAfterSaveToHeritageFunnel(this.$route);
} else {

View file

@ -175,7 +175,7 @@ export default ({
);
// Standard place_changed event handling
autocomplete.addListener('place_changed', fillInAddress);
const autocompleteListener = window.google.maps.event.addListener(autocomplete, 'place_changed', fillInAddress);
// Wrapping the addressField1 element in the Google Address Autocomplete object
// will cause "autocomplete='off'" which Chrome completely ignores. This event
@ -225,7 +225,6 @@ export default ({
}
if (place && place.address_components) {
self.addressModel.streetAddress= "";
self.showAddressFields = true;
for (const component of place.address_components) {
@ -262,7 +261,15 @@ export default ({
else {
self.displayVerificationWarning = true;
self.displayNoMatchWarning = false;
}
}
// after showing the address fields, disable the address autocomplete
window.google.maps.event.removeListener(autocompleteListener);
window.google.maps.event.clearInstanceListeners(autocomplete);
addressField1.onchange = null;
const pacContainer = document.querySelector(".pac-container");
pacContainer.remove();
}
})
.catch(() => {