+ Start a Discussion
David OvellaDavid Ovella 

​How to pass from a page1 to another page2 with some information of the page1?

Hello, can anyone help me please.
I am using a visualforce page and I want to know,
once I've created and saved a field, can I go to another pages with the information of the page before?
Best Answer chosen by David Ovella
Jerome LusinchiJerome Lusinchi
Hi David,

Check this documentation :
https://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_wizard.htm

With a wizard, you can go from one VF to another and keep the context. The controller of your 2 VF is the same

Regards,
jerome

All Answers

Jerome LusinchiJerome Lusinchi
Hi David,

Check this documentation :
https://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_wizard.htm

With a wizard, you can go from one VF to another and keep the context. The controller of your 2 VF is the same

Regards,
jerome
This was selected as the best answer
Shaijan ThomasShaijan Thomas
// First VF page
<apex:page controller="First_Second_Thrid_Controller">
<apex:form >
  <!-- Begin Default Content REMOVE THIS -->
  This is your FirstPage <p></p>
  Enter Value and Click Button : <apex:inputText value="{!FirstPageValue}"/> <p></p>
  <apex:commandButton value="GotoSecondPage" title="GotoSecondPage" action="{!GotoSecondPage}"/>
  </apex:form>
</apex:page>
// Second VF Page
<apex:page controller="First_Second_Thrid_Controller">
<apex:form >
  <!-- Begin Default Content REMOVE THIS -->
  This is your new Page: SecondPage <p></p> Frist Page value : {!FirstPageValue} <p></p>
  Enter Value and click Button : <apex:inputText value="{!SecondPageValue}"/> <p></p>
  <apex:commandButton value="GotoThirdPage" title="GotoThirdPage" action="{!GotoThirdPage}"/>
  </apex:form>
</apex:page>
//Third VF page
<apex:page controller="First_Second_Thrid_Controller">
This is your third Page <p></p>
First Page Value : {!FirstPageValue}<p></p>
Second page Value : {!SecondPageValue}<p></p>
</apex:page>
//Common Controller
public class First_Second_Thrid_Controller {

    public PageReference GotoThirdPage() {
    
        PageReference np1 = Page.Thirdpage;
        np1.setRedirect(false); 
        return np1;
    }


    public String SecondPageValue { get; set; }

    public PageReference GotoSecondPage() {
        PageReference np = Page.SecondPage; 
        np.setRedirect(false); 
        return np;
    }


    public String FirstPageValue { get; set; }
}

Please check this code, it may help you
Thanks
Shaijan