function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rony57Rony57 

How to use Google Places API with a search button?

Hello Guys  i am stuck in the google map while using it in VF page . I need to  locate the city along with the street adress on the google map and   draw radius when ever user click on  the search button . My Autocomplete textbox is working  . I need to add the seach functionality  on the seach button.
Here is my code:-
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true&libraries=places"></script>
<script type="text/javascript">
        var map;
        
function initializeField() {
var input = document.getElementById('page:frm:field');           
var autocomplete = new google.maps.places.Autocomplete(input); 
var mapOptions = {
zoom:6,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false,

center: new google.maps.LatLng(20.593684,78.962880)
};
map = new google.maps.Map(document.getElementById('MyMap'),
  mapOptions);
}
google.maps.event.addDomListener(window, 'load', initializeField);

</script>


 <input type="button" class="btn customBtn pull-right"  value="Search" />

Help me out
NagaNaga (Salesforce Developers) 
Dear Anurag,

I have found out a very similar code to this.

http://stackoverflow.com/questions/20491405/how-to-use-google-places-api-with-a-search-button

Please let me know if this helps

Best regards
Naga Kiran
Rony57Rony57
@ Naga Kiran  thanx  a lot  but  my requirement is different  and the link what you send me is not working in my case. If possible can you help me out ?