Forums

Location Data in Chronoform fields

spytech 26 Jun, 2019
Hi, I was wondering if Chronoforms has anything built in to receive location data (Longtitude and Latitude) as part of a form. I could not find any answers in the forums. If you have any ideas of how this can be done I would be most appreciative. Users will be mostly doing this on their mobile phone.

Thanks.
GreyHead 26 Jun, 2019
1 Likes
Hi spytech,

There is nothing 'built-in' but if the browser has access to the phone's location then you can use it. See here for some examples.

Bob
earthwatch 26 Jun, 2019
Hi Bob, great, thanks for that I'll give it a try.
edebeer 04 Jul, 2020
The example link does not work.
GreyHead 05 Jul, 2020
Hi edebeer,

It works OK for me. https://www.w3schools.com/html/html5_geolocation.asp

Bob
edebeer 05 Jul, 2020
Thanks.

How would I get the Latitude and Longitude in to a hidden field in Chronoforms. In a regular form I would do something like this: <input type="hidden" name="longitude" id="longitude" />. How do I get the id into the "Value" field of the hidden field? I want to save Latitude and Longitude to the database.
GreyHead 05 Jul, 2020
Hi edebeer,

If you include empty hidden inputs in the form then you can use the Standard JavaScript value methods to add the data you find.

Bob
edebeer 05 Jul, 2020
How do you use Standard JavaScript value methods to add the data you find?
GreyHead 05 Jul, 2020
Hi edebeer,

See this StackOverFlow answer for example https://stackoverflow.com/a/5700542

Bob
This topic is locked and no more replies can be posted.