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
Sonya Dhand 3Sonya Dhand 3 

Visualforce page not refreshing whole object page when edited

Hi I have a vf page on a custom object and I can edit it and click on the save button and it looks like the changes have been made until I refresh the whole page and then my changes are no longer saved to my vf page block

Here is my code
 
<apex:page cache="false" standardController="Employee__c" tabStyle="Employee__c" showHeader="false" sidebar="false">
    <apex:form id="all" >
        <apex:pageMessages />
     
        <apex:pageBlock title="Worker Licence Record Section" mode="inlineEdit">
     
        
           <apex:pageBlock mode="maindetail">
           
           
           

           
            <apex:pageBlockButtons location="top">
                
             
                
                <button onclick="location.href='/apex/Worker_Section?id={!Employee__c.Id }'" id="saveButton">
                    Save
                </button>
                
                <button onclick="location.href='/apex/Worker_Section?id={!Employee__c.Id }'" id="cancelButton">
                    Cancel
                </button>
                
            </apex:pageBlockButtons>
            <style>
                     .bPageBlock {
                                background-color: white !important;
                     }
                     
                     .pbHeader{

        color:grey;

        width:100%;

        font-size:90%;

        }

               </style>
               
               
            
            
            <apex:outputPanel styleClass="white" layout="block">
                
                <apex:pageBlockSection collapsible="true" columns="3">
                
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%"  >
                        <apex:outputLabel >SIA Licence Type</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.SIA_LICENCE__c}" style="width:80px"/>
                    </apex:pageBlockSectionItem>
                    
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%"  >
                        <apex:outputLabel >SIA Licence #</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.Licence_No__c}" style="width:125px"/>
                    </apex:pageBlockSectionItem>
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%"  >
                        <apex:outputLabel >Expiry Date</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.Expiry__c}" style="width:100px"/>
                    </apex:pageBlockSectionItem>
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%"  >
                        <apex:outputLabel >CSCS Card?</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.CSCS_Card__c}" style="width:80px"/>
                    </apex:pageBlockSectionItem>
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%"  >
                        <apex:outputLabel >CSCS Licence #</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.CSCS__c}" style="width:125px"/>
                    </apex:pageBlockSectionItem>
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
                        <apex:outputLabel >Expiry Date</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.CSCS_Expiry_Date__c}" style="width:100px"/>
                    </apex:pageBlockSectionItem>
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%"  >
                        <apex:outputLabel >CCTV Licence?</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.CCTV_Licence_Type__c}" style="width:80px"/>
                    </apex:pageBlockSectionItem>
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
                        <apex:outputLabel >CCTV Licence #</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.CCTV_Licence__c}" style="width:125px"/>
                    </apex:pageBlockSectionItem>
                    
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%"  >
                        <apex:outputLabel >Expiry Date</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.CCTV_Expiry__c}" style="width:100px"/>
                    </apex:pageBlockSectionItem>
                    
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
                        <apex:outputLabel >Driving Licence?</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.Driving_Licence__c}" style="width:80px"/>
                    </apex:pageBlockSectionItem>
                    
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
                        <apex:outputLabel >Driving Licence #</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.Driving_Licence_Number__c}" style="width:125px"/>
                    </apex:pageBlockSectionItem>
                    
                    
                    <apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%"  >
                        <apex:outputLabel >Expiry Date</apex:outputLabel>
                        <apex:inputField value="{!Employee__c.Driving_Licence_Expiry__c}" style="width:100px"/>
                    </apex:pageBlockSectionItem>
                    
                    
                    
                    
                </apex:pageBlockSection>
            </apex:outputPanel>
            
            </apex:pageBlock>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Any ideas?
NagendraNagendra (Salesforce Developers) 
Hi Sonya,

I see in your code that you are using onlick  and calling the save method from the class Worker_Section.

Please send me the Worker_Section code  so that I can help you.

Best Regards
Nagendra