Google Maps Api AutoComplete

This forum contains topics that were moved from Get Satisfaction
adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

Google Maps Api AutoComplete

Post by adam griffin »

U can use $(#"component_id").val and in your mapping you can just get the Val from localstorage

shabeer
Posts: 0
Joined: Thu Mar 12, 2015 2:46 pm

Google Maps Api AutoComplete

Post by shabeer »

Hi,

I am trying to get the autosearch part using google places to work.

I copied the javascript code from http://jsfiddle.net/aartyukh/2LK9H/1/ and pasted it as a onPageShow run script.

I copied the html into my page.html file in web_resources.

I also have a input palette component named "autocomplete_form".

I am expecting autosearch suggestions to appear when I test it.

Am I missing something?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Google Maps Api AutoComplete

Post by Yurii Orishchuk »

Hi Shaberr,

Please follow this solution:

1 Open your app settings on "External resources" tab.

2 Take a look on "User-defined resources" part. There should be.

pre

http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places

/pre

3 If you can not find it - add it there. Details: http://prntscr.com/536jl3/direct

4 Remove previously autocomplete.

5 Add HTML component on the page.

6 Populate it with following HTML code. Details: http://prntscr.com/536jy7/direct

precode

<input id="location_input" type="text" onchange="console&#46;log(getLatLngFromAddress(this&#46;value));" name="location_input"class="input-prompt" placeholder="Specify where your event will happen&#46;">

<script>

function initialize() {
console&#46;log("google initialize");
var input = document&#46;getElementById('location_input');
var autocomplete = new google&#46;maps&#46;places&#46;Autocomplete(input);

Code: Select all

 google&#46;maps&#46;event&#46;addListener(autocomplete, 'place_changed', function() { 

     var place = autocomplete&#46;getPlace(); 

     var location = place&#46;geometry&#46;location; 

     alert(JSON&#46;stringify(location)) 
 }) 

}

google&#46;maps&#46;event&#46;addDomListener(window, 'load', initialize);

</script>

/code/pre

Regards.

Akash Chakrawarti
Posts: 0
Joined: Sat Oct 31, 2015 7:48 am

Google Maps Api AutoComplete

Post by Akash Chakrawarti »

error occurs
a.getAttribute is not a function.. //a is textfield..

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Google Maps Api AutoComplete

Post by Evgene Karachevtsev »

Hello Akach,

Could you please clarify your issue with more details?

Mark MB
Posts: 0
Joined: Wed May 27, 2015 7:34 am

Google Maps Api AutoComplete

Post by Mark MB »

Hi Yurii Orishchuk,
Worked like a charm! Thanks for the great support!

Manasa Pochampally
Posts: 0
Joined: Tue Dec 20, 2016 12:09 am

Google Maps Api AutoComplete

Post by Manasa Pochampally »

Hey Akash , could you able to implement this autocomplete search for places ? I'm working on IONIC , if its working for , could you please share the code or screenshot of your application? it would be a great help !
Regards,
Manasa

Post Reply