MadimetjaShika / vuetify-google-autocomplete

A Vuetify ready Vue.js autosuggest component for the Google Places API.
https://madimetjashika.github.io/vuetify-google-autocomplete/
MIT License
97 stars 53 forks source link

Making mandatory to choose one option from the list #89

Closed juansinmiedos closed 4 years ago

juansinmiedos commented 4 years ago

I think this is a bug: When you write something in the input and don't select any option of the autocomplete list you can send the information in the input (without sending an object with a location information).

Right now I am working in a project where I must send the name of the address, the lat and lng. Since the fields of lat and lng are not written by the user and are automatically filled when the user clicks an option I have put this validation rule:

addressRules: [ v => !!v || "La dirección es requerida.", v => (v && this.customer.lat != 0) || "Busca una dirección y selecciónala de la lista." ],

Where the form cannot be send if the user haven't chose an option (an ergo the lat field is different than 0).

The problem is that if the user select an option (lat field is filled) and then erases the address and write anything else without writing another option the form will be sent (lat and lng were never modified and remain with the chosen option). This issue presents itself again if the user wants to edit the customer information, and again, doesn't choose an option from the list.

MadimetjaShika commented 4 years ago

@juansinmiedos please reopen this if v2.0.1 does not fix your problem.