In this guide, we will explain how to capture Latitude and Longitude values on your form.
- Please add two Text fields for the Latitude and Longitude:
- Please add a JavaScript field with the below code:
var latitude_field = 'bd15-19d1-ac08';
var longitude_field = '9222-7efb-8af0';
// Get Location
navigator.geolocation.getCurrentPosition(
  function( position ) {
    // Set values
    window.formyoula.form_fields[ latitude_field ].set( 'value', position.coords.latitude );
    window.formyoula.form_fields[ longitude_field ].set( 'value', position.coords.longitude );
  },
  function( error ) {}, 
	{ maximumAge: 0, timeout: 5000, enableHighAccuracy: true }
);
- Please update the Text field IDs in the code:
For any questions, please contact us - [email protected] or the Formyoula in-app chat 🙂