Forums › Gravity Geolocation › Where to hook js on change/use of locatorButton, markerDrag, or address entry
Tagged: action, extend, gravity form, hook, javascript, jQuery
- This topic has 1 reply, 2 voices, and was last updated 6 years ago by
Eyal Fitoussi.
-
AuthorPosts
-
July 15, 2016 at 9:03 am #53249
Peter
MemberI’m using your Geolocation for Gravity Forms.
I have some custom jQuery that needs to execute anytime the user sets the map marker via dragging it, and whenever the users enters an address, and whenever the user uses the locator button. Which hook/filter can i use to achieve that? Can you help me construct it? Does it need any paramaters?
Ultimately, dragging the map marker, entering an address, and using the locator button seems to update the Latitude and Longitude fields on the form (e.g. the Coordinates). My jQuery function relies on these updated values because it does something with the values. As such, can you advise where to hook my Jquery into so that it runs after each of these 3 interactions? My attempt below at listening to a change of these values is not ideal as my code below relies on a human to make the change via the UI directly to those fields. What I really want is to use your hooks to execute my custom logic instead of relying on the .onchange event.
document.getElementById(“input_1_24_longitude”).onchange = function() {
console.log(“Changed!”);
var latvalue = document.getElementById(“input_1_24_latitude”);
var longvalue = document.getElementById(“input_1_24_longitude”);
document.getElementById(“input_1_31”).value = latvalue.value + “, ” + longvalue.value;}
document.getElementById(“input_1_24_latitude”).onchange = function() {
var latvalue = document.getElementById(“input_1_24_latitude”);
var longvalue = document.getElementById(“input_1_24_longitude”);
document.getElementById(“input_1_31”).value = latvalue.value + “, ” + longvalue.value;
}</script>
July 15, 2016 at 10:49 am #53252Eyal Fitoussi
MemberHello Peter,
There is no such hook available at the moment. However, I can try to add a new hook, which you could probably use, and release a new version over the weekend. -
AuthorPosts
You must be logged in to reply to this topic.