function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AK_SmithAK_Smith 

reload salesforce1 page after save

How to refresh parrent page in salesforce1 after save VF page 
My code is:
 
<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>
<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"/>
           
          
            
</apex:form>

</apex:page>


 
Best Answer chosen by AK_Smith
sfdcMonkey.comsfdcMonkey.com
Hi AK_Smith , try below code :

<apex:commandButton action="{!save}" value="Save" oncomplete="reload()"/>

<script>
function  reload(){
   sforce.one.back(true);
}
</script>

i hope it helps you.
   Let me inform if it helps you
thanks
sfdcmonkey.com

All Answers

sfdcMonkey.comsfdcMonkey.com
Hi AK_Smith , try below code :

<apex:commandButton action="{!save}" value="Save" oncomplete="reload()"/>

<script>
function  reload(){
   sforce.one.back(true);
}
</script>

i hope it helps you.
   Let me inform if it helps you
thanks
sfdcmonkey.com
This was selected as the best answer
AK_SmithAK_Smith
Thank you!
Works like magic!