You need to sign in to do that
Don't have an account?
AK_Smith
run VF page onload
Hello!
How to run my page in SF1 "onload"?
geoFindMe() than save and than reload()
Thank you!
How to run my page in SF1 "onload"?
geoFindMe() than save and than reload()
<apex:page standardController="Project__c" id="page" docType="html-5.0"> <p><button onclick="geoFindMe()">Show my location</button></p> <p id="out"></p> <script> function geoFindMe() { var output = document.getElementById("out"); if (!navigator.geolocation){ output.innerHTML = "<p>Geolocation is not supported by your browser</p>"; return; } function success(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; document.getElementById('page:form:lati').value = latitude.toString().replace(".",",") ; document.getElementById('page:form:long').value = longitude.toString().replace(".",",") ; }; function error() { output.innerHTML = "Unable to retrieve your location"; }; navigator.geolocation.getCurrentPosition(success, error); } </script> <script> function reload(){ sforce.one.back(true); } </script> <apex:form id="form"> latitude :<apex:inputField id="lati" value="{!Project__c.l__c}" /> longitude :<apex:inputField id="long" value="{!Project__c.ll__c}" /> <apex:commandButton action="{!save}" value="Save" oncomplete="reload()"/> </apex:form> </apex:page>
Thank you!
i hope it helps you.
Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
thanks
sfdcmonkey.com
All Answers
i hope it helps you.
Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
thanks
sfdcmonkey.com
Works only for the geoFindMe(). But the page did not close and did not update