JasonRake
7 years agoQrew Trainee
Geolocation and form fields
I am trying to create a button that fills in two fields on a form for a new record. I have downloaded the GeoLocate app from the exchange and am trying to use the geo.js and the get location button from this app in our timesheets app. Problem is when I click the get location button the page just reloads and doesn't fill in the form fields or pull the geolocation data from the browser.
_______________________________________________________________________
Modified geo.js script
jQuery(document).ready(function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
var test = $.ajax({url: url,async:false,success: pushResult}).responseText;
return false;
});
function showPosition(position){
var editURL = "";
editURL = "bnifp6kni";
editURL += "?act=API_EditRecord&key=" + QBU_recid;
editURL += "&_fid_13=" + position.coords.latitude;
editURL += "&_fid_14=" + position.coords.longitude;
$.ajax({url: editURL,async:false});
location.reload(true);
}
__________________________________________________________________________
Button Formula
"javascript:" &
"var QBU_recid="& [Record ID#] &";" &
"void(jQuery.getScript('" & URLRoot() & "db/bmic8pqiv?act=dbpage&pagename=geo.js'))"
Any help on this would be greatly appreciated.
_______________________________________________________________________
Modified geo.js script
jQuery(document).ready(function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
var test = $.ajax({url: url,async:false,success: pushResult}).responseText;
return false;
});
function showPosition(position){
var editURL = "";
editURL = "bnifp6kni";
editURL += "?act=API_EditRecord&key=" + QBU_recid;
editURL += "&_fid_13=" + position.coords.latitude;
editURL += "&_fid_14=" + position.coords.longitude;
$.ajax({url: editURL,async:false});
location.reload(true);
}
__________________________________________________________________________
Button Formula
"javascript:" &
"var QBU_recid="& [Record ID#] &";" &
"void(jQuery.getScript('" & URLRoot() & "db/bmic8pqiv?act=dbpage&pagename=geo.js'))"
Any help on this would be greatly appreciated.