0

I have an Asp Textbox. Now i want to integrate it to get cities of a specific country and provide autocomplete feature in it. That i accomplished using this.

var options = {
                types: ['(cities)'],
                componentRestrictions: { country: "in" }
              };
new google.maps.places.Autocomplete(document.getElementById('txtPlaces'),options);

Now what i want to do is to provide a validation such that user has to select a city from Auto Complete and cannot enter any other unknown city.

The validation should also provide some indication to user such that he/she knows that the value entered is correct and can move on to fill next values

Please help me out on this. Thanx in Advance.

Murtaza Munshi
  • 1,065
  • 4
  • 13
  • 40

1 Answers1

0

Observe the place_changed-event of the Autocomplete, when the place has a geometry-property it's a valid place based on the suggestions

Dr.Molle
  • 116,463
  • 16
  • 195
  • 201