Capture GEO Location on Form Entry Submission

In this guide, we will demonstrate how to capture GEO location once a form entry is submitted.

1. Please edit your existing form template:

2. Add two Hidden fields on your form one for the Latitude and the other for the Longitude values.

3. Please add a JavaScript element on your form with the following code:

function get_geo_details() {

  //Record Location

  navigator.geolocation.getCurrentPosition( function(position){

   //Set values

   window.formyoula.form_fields["8570-e7c4-c1c6"] && window.formyoula.form_fields["8570-e7c4-c1c6"].set("value", position.coords.latitude);

   window.formyoula.form_fields["9904-76e0-c28f"] && window.formyoula.form_fields["9904-76e0-c28f"].set("value", position.coords.longitude);

  }, function(error){

    //Record error if needed

 }, {maximumAge:0, timeout:5000, enableHighAccuracy:true} );


//Check if GEO supported

if(navigator.geolocation && navigator.geolocation.getCurrentPosition){

 //Get GEO

 var set_interval_id = setInterval(get_geo_details, 5000);


//Remove set interval on form submit

$(".finish, .cancel, .draft").on("click",function(){



4. Please Save & Close the form.

5. Next, please open to edit the form once more in one browser tab and please open the PDF Editor in another tab. From the PDF Editor, please copy the merge field IDs for the Hidden Longitude and Latitude fields.

6. Please change the ID values in the JavaScript code with your merge field ID values from the PDF Editor:


7. Please Save & Close the form.

8. Now the GEO Location will be captured once you start a form entry (standard functionality) and once you submit it (custom functionality added by the steps on this guide). You can map these fields to your Salesforce records. And you can also view the GEO Location values on the CSV export file.

For any questions, please contact us -

Feedback and Knowledge Base