jeffreykemp / jk64-plugin-reportmap

Report Google Map APEX Plugin
https://jeffreykemp.github.io/jk64-plugin-reportmap/
MIT License
42 stars 16 forks source link

Raise event trigger when address search sets lat/lng #29

Closed monster50mx closed 8 years ago

monster50mx commented 8 years ago

Hi

I'm usign you pluggin and i install the demo to learn how it works. In the page where you search an address usess ltn and lng for the country i need to catch de lat and lng of the address, the question is, how can i do this?

tnx for your help

Regards

PD> Sorry, i'm still practice my english

jeffreykemp commented 8 years ago

Hi monster50mx,

Thank you for your question.

When the user enters an address to search, the plugin currently just puts a pin at the location.

If your region has a static ID (e.g. "mymap"), you can obtain the last pin's position by using the following javascript:

opt_mymap.userpin.position.lat()
opt_mymap.userpin.position.lng()

Unfortunately, there's no event currently implemented that will allow you to respond to this automatically; so for now you will need to implement your own method (e.g. you could copy the lat,lng into a page item when the user clicks a "Save" button).

You've given me an idea, that it would be easier if the plugin triggered an event when this happens, so you'd be able to add a Dynamic Action to respond to this action. I will raise this as an enhancement request.

I hope this helps.

Jeff

monster50mx commented 8 years ago

Thank you this helps very, very much.

Regards

jeffreykemp commented 8 years ago

Hi monster50mx,

I've just released v0.7 which has a new trigger - "addressFound" which fires when the user does an address search.

Please update your version and let me know if it works for you.

Thanks,

Jeff

monster50mx commented 8 years ago

Hi Jeffrey !!

Thanks !!

What are the instructions for implemente the new trigger?

jeffreykemp commented 8 years ago

Add a Dynamic Action to the region, that fires on the Event "addressFound".

Add javascript to execute when the event fires, e.g. to copy the lat,lng to an item, you might use the following javascript:

$s("P1_LAT_LNG", this.data.lat+","+this.data.lng);

Don't forget to set "Fire on Page Load" to No.

monster50mx commented 8 years ago

thank you very much it works !!!