HTML5 Get Location

HTML5 Get Location

  
Hello, 

I am wondering if anyone could show me how to execute the HTML5 Get Location function [example: http://www.w3schools.com/html/html5_geolocation.asp] and have that data placed in a text box and saved in an specified Entity Attribute when I press save in the mobile application. 

My goal is to have a Geo tag with every record. 

Thank you, 

David
out of my head and pretty straighforward (untested!)

- create a input-box on your screen, ( optiona: set extended properties so the box is hidden.)
- fill the inputbox with the geo-location with javascript.

for example:

1. add to the save button an onclick function,  "getLocation();"
  ofcourse you can call the js-function when-ever you want, it migth be when loading the screen or whatever, your call...

2. add the (slightly altered) script to the screen with an expression

<script>
var x=document.getElementById('  + hiddenInputBox.id + ');
function getLocation()
  {
  if (navigator.geolocation)
    {
    navigator.geolocation.getCurrentPosition(showPosition);
    }
  else{x.value="-1::-1";}
  }
function showPosition(position)
  {
  x.value=position.coords.latitude +  ":: " + position.coords.longitude;
  }
</script>
Hi David,
I think the above answer does the trick perfectly... For a more assisted way of doing it:
In Service Studio, go to the OutSystems tab at the top left, and install the Mobile Sales application from the catalog. After it is installed it will show you a tutorial that explains exactly how to do that in an interactive mode. By the end of the tutorial you have geolocation in the mobile sales application.