TOPIC:

Tutorial: Use the Autocomplete for Addresses Google API 8 months 1 week ago #252944

  • Topic Author
  • zeroalpha
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 11
  • Thanks: 1
Thought I would write a basical tutorial to help anyone who wants to use the Google API Autocomplete for addresses in their form which looks like this:


developers.google.com/maps/documentation.../places-autocomplete

This is for a simple one line textfield.

You will need a google API Key: developers.google.com/places/web-service/get-api-key

Now go to your breezingforms>manage form>select your form>Advanced>more options>Form pieces>Before Form>Select Custom

Add this line:
echo '<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=ADDYOURGOOGLEAPIKEYHERE&libraries=places"></script>';

Make sure you replace ADDYOURGOOGLEAPIKEY with your actual key. Your code should look like this:



Now add this javascript to: Scripts>Initialize Script>Select Custom
function init() {
    var input = document.getElementById('ff_elem???');
    var autocomplete = new google.maps.places.Autocomplete(input, options);
    }
google.maps.event.addDomListener(window, 'load', init);

You will need to find your element ID your using for addresses. I simply found it with 'View Source' from my browsers html code or from your website you can Right-Click>Inspect :


Your code should look like this:



CONGRATULATIONS! You now have a working address lookup autocomple working on your form
Attachments:
The following user(s) said Thank You: v8tom

Please Log in or Create an account to join the conversation.

Tutorial: Use the Autocomplete for Addresses Google API 8 months 1 week ago #252949

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6998
  • Karma: 3
  • Thanks: 499
Hi,

thanks for sharing this :)

Regards,
Tihana

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.176 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!