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
himanshu huske 7himanshu huske 7 

VF Page Parameters

I have customer__c object with FirstName_c, LastName_c, DOB_c fields.
First VF page has  FirstName_c, LastName_c, DOB_c  InputFields and a "save" button which save record in Object
And "List" Button show that record fields with that values of input field in Second VF page.
 
Alok Singh 140Alok Singh 140
So what help do you need?
himanshu huske 7himanshu huske 7
Hi Alok,
I would be great, if you provide me code for this scenerio...
sorry, I forgot to mention.
Khan AnasKhan Anas (Salesforce Developers) 
Hi Himanshu,

Greetings to you!

Below is the sample code which I have tested in my org and it is working fine. Kindly modify the code as per your requirement.

Visualforce Page 1 : VfPage1
<apex:page controller="VfPageC">
    <apex:form >
        <apex:actionRegion >
            <apex:pageBlock id="pbAccountDetails">
                <apex:pageBlockSection columns="1" collapsible="false">
                    <apex:inputField value="{!account.Name}" required="true" />   
                    <apex:inputField value="{!account.Phone}" required="true" />
                </apex:pageBlockSection>    
                <apex:pageBlockButtons >
                    <apex:commandButton action="{!saveRecord}" value="Save"/>
                    <apex:commandButton action="{!page2}" value="Next"/>
                </apex:pageBlockButtons>
            </apex:pageBlock>
        </apex:actionRegion>
    </apex:form>
    
</apex:page>

Visualforce Page 2 : VfPage2
<apex:page controller="VfPageC" >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!page1}" value="Previous" />
            </apex:pageBlockButtons>
            <apex:pageBlockSection >
                <apex:outputField value="{!account.Name}"/>
                <apex:outputField value="{!account.Phone}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller : VfPageC
public class VfPageC {
    
    public String accId{get;set;}
    public Account account{get;set;}
    
    public VfPageC(){
        account = new Account();
    }
    
    public PageReference page2(){
        return Page.VfPage2;	
    }
    
    
    public PageReference page1(){
        return Page.VfPage1;	
    }
    
    public pageReference saveRecord(){
        INSERT account;
        //account = new Account();
        return null;
    }
}

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas