Reputation: 58
I'm using Google Maps Javascript API V3 Places Library in order to add Places Autocomplete feature to my page. It is working like described no issues here:
When a user selects a Place from the list, information about the Place is returned to the Autocomplete object, and can be retrieved by your application.
The case I'd like to handle is if user does not select place from autocomplete dropdown but submits search form. Now I'm collecting user's input, sending it to Google Geocoding service and displaying user a list of Geocoding results so user can choose one to complete a form.
So idea is the following: either user selects place from autocomplete dropdown or selects it from Geocoder list.
My main concern is that results returned are different. The question is the following: Is it possible somehow to intercept in JS object containing autocomplete results returned by places library in order to show list of options if user does not choose one from dropdown list?
thanks in advance.
Upvotes: 2
Views: 1369
Reputation: 3955
What you could do is do a server-side Places Autocomplete request and present the results to the user. Those results should be the same as those provided by the Javascript API Places Autocomplete. Then use the reference for the selected result to perform a Place Details request.
Upvotes: 2