I have a VF page where Account data is entered, before saving the record I am redirecting to a different page here I don't want to pass already entered values as parameters but I want to maintain view state (I shouldn't loose already entered data on Vf page).
Is it possible to do that ?
Here is my code :
AccountPage :
<apex:page standardController="Account" extensions="selectPrice">
<apex:form>
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlock
<apex:pageBlockButtons >
<apex:commandButton action="{!saveaccs}"
value="Save " />
<apex:commandButton action="{!cancel}" value="Cancel" />
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField value="{!Account.Name }" id="RID" required="true" />
<apex:inputField value="{!Account.Region__c}" />
<apex:inputField value="{!Account.State__c }" required="true" />
<apex:inputField value="{!Account.Price__c}" />
</apex:pageBlockSection>
<apex:commandButton action="{!selectPrice}" value="Select Price"> </apex:commandButton>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller :
public class selectPrice {
public controllercls(ApexPages.StandardController controller) {
// code
accountRec = (Acount)controller.getRecord();
//end
}
public PageReference selectPrice() {
PageReference pr = new PageReference('/apex/otherpage?Name='+accountRec.Name);
return pr;
}
}
Otherpage:
<apex:commandButton action="{!gobacktoAccPage}" value="Go Back"> </apex:commandButton>
Controller for Otherpage:
public PageReference gobacktoAccPage() {
PageReference pr = new PageReference('/apex/AccountPage');// when I go to this page already entered values are showing as null
return pr;
}