Page 1 of 1

Unable to put a marker based on an address into the Map

Posted: Wed Feb 19, 2014 3:32 am
by 2fas2c

I have an address field on a page. On the same page, I have a button "Map Location". On click of the button, I set the address into a localStorage variable and then launch another page (MapLocation) which has the Map component. On page load of MapLocation, I have the following code:

var fulladdress = localStorage.getItem("fulladdress");
var map = Appery("map");
map.options["address"] = fulladdress;
map.refresh();

The map gets displayed but the address is not marked. I do get an error/warning in the Firebug that the map is not initialized.

If I add a button on MapLocation page and execute the same code on button click, everything works fine. The marker is added in the right location and it also zooms to the right level.

How can I get it to work on load instead of button click?

Thanks


Unable to put a marker based on an address into the Map

Posted: Wed Feb 19, 2014 3:49 am
by Igor

Hello,

Lets try to add initialize() function on page load event :
http://docs.appery.io/tutorials/build...
https://developers.google.com/maps/do...


Unable to put a marker based on an address into the Map

Posted: Wed Feb 19, 2014 4:06 am
by 2fas2c

I am sorry but are you asking me to move the code that I have into an initialize() method and associate the initialize() method to window load using

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

in the page Load event?

function initialize() {
var fulladdress = localStorage.getItem("fulladdress");
var map = Appery("map");
map.options["address"] = fulladdress;
map.refresh();
}


Unable to put a marker based on an address into the Map

Posted: Wed Feb 19, 2014 7:46 pm
by Maryna Brodina

Hello! Please take a look here https://getsatisfaction.com/apperyio/...