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
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');
  pageRef.setRedirect(true);
  return pageRef;
}

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

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,
-Vivek
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;
        congratsPage.setRedirect(true);
        congratsPage.getParameters().put('id',controller.getId());
        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