How can I implement Google Place Autocomplete at one of my custom text fields ?

  • In the salesforce UI or in visualforce ? Apr 8, 2014 at 10:24
  • Basically in the UI, but both would be good to know.
    – David Renz
    Apr 8, 2014 at 10:26

1 Answer 1


I found a way to do it in Visualforce:

<apex:page id="page">

    <script src="https://maps.googleapis.com/maps/api/js?language=de&sensor=false&libraries=places" type="text/javascript"></script>  
    <script type="text/javascript"> 

        function initializeField() {        
            var input = document.getElementById('page:form:pb:pbs:field');           
            var autocomplete = new google.maps.places.Autocomplete(input); 

        google.maps.event.addDomListener(window, 'load', initializeField);  


    <apex:form id="form">
        <apex:pageBlock id="pb">
            <apex:pageBlockSection id="pbs">
                <apex:inputText id="field"/>


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.