You need to sign in to do that
Don't have an account?
Roberto Nisti
OnCLick Javascirpt get geolocation
Hi,
I try to get geolocation when I click on button. I Try it:
{!REQUIRESCRIPT("/soap/ajax/44.0/connection.js")}
var options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
function success(pos) {
var crd = pos.coords;
{!Contact.MailingLatitude} = crd.latitude;
{!Contact.MailingLongitude} = crd.longitude);
};
function error(err) {
console.warn('ERROR(' + err.code + '): ' + err.message);
};
navigator.geolocation.getCurrentPosition(success, error, options);
But, when a check the syntax, show me this error:
<span class="errorStyle">Error: The Name field is required.</span>
I try to get geolocation when I click on button. I Try it:
{!REQUIRESCRIPT("/soap/ajax/44.0/connection.js")}
var options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
function success(pos) {
var crd = pos.coords;
{!Contact.MailingLatitude} = crd.latitude;
{!Contact.MailingLongitude} = crd.longitude);
};
function error(err) {
console.warn('ERROR(' + err.code + '): ' + err.message);
};
navigator.geolocation.getCurrentPosition(success, error, options);
But, when a check the syntax, show me this error:
<span class="errorStyle">Error: The Name field is required.</span>
Raj Vakati
Looks like its not code .. The Name field is required .. You have to enter the name fields firrst and save the record and then click on this button yo get the geolocation