I want to refresh an entire page after a record is saved using the save command button. I can't see why it is not refreshing as default. Here is the code of the page:
<apex:sectionHeader title="DBVC Maintenance Request Evaluation"/>
<apex:form >
<apex:pageBlock title="">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection showHeader="true" title="Evaluate Maintenance Request" columns="1">
<apex:inputField value="{!MR_Evaluation__c.Evaluation_Ref__c}"/>
<apex:pageBlockSectionItem />
<apex:inputField value="{!MR_Evaluation__c.Maintenance_Request_Ref__c}"/>
<apex:pageBlockSectionItem />
<apex:inputField value="{!MR_Evaluation__c.MR_Eval__c}"/>
<apex:pageBlockSectionItem />
<apex:inputField value="{!MR_Evaluation__c.Comments__c}"/>
<apex:pageBlockSectionItem />
<apex:inputField value="{!MR_Evaluation__c.Service_Provider__c}"/>
<apex:pageBlockSectionItem />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
Best Answer
The standard controller do not provide this functionality out of the box so you would need to write an extension class for this -
VisualForce Page
Define a method SaveAndNew on your controller extension
where myStdController is an instance variable of type ApexPages.StandardController and ensure to initialize it on the constructor of your controller extension class