+ Start a Discussion
Dhananjaya BulugahamulleDhananjaya Bulugahamulle 

how to save all the information and redirect to a new page after saving?

I have two pages with same fields. One page with input fields (Apex/page1), and the other one with output fields (Apex/page2). Any idea how to save and redirect to the page 2 with all values? 
Vivek DeshmaneVivek Deshmane
Hi Dhananjaya,

On form submission involve an action method from the Apex controller then you can use the PageReference class to include the query strings you need. For example:

public PageReference someAction(){

  PageReference pageRef = new PageReference('/apex/YOURVFPAGE?param1=value1&param2=value2');
  return pageRef;

<apex:outputText value="{!$CurrentPage.parameters.param1}"

More information on the PageReference class can be found here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_system_pagereference.htm

Please let me know if this helps you.

Best Regards,
Dhananjaya BulugahamulleDhananjaya Bulugahamulle
@ Vivek Deshmane Thanks for the reply.  First I Want to save and redirect. 
public PageReference save(){
        if(controller.save() != null) {
        PageReference congratsPage = Page.pitu3;
        return congratsPage;
return page.pitu3;

I used above code. But the weird thing is it only works for some field. Any idea why?
Vivek DeshmaneVivek Deshmane
Here after saving record ,you passing id and making query in next page controller to get related data right?
Dhananjaya BulugahamulleDhananjaya Bulugahamulle
Correct. Pass all info into next page. Thanks