Based on my requirement I have to create 10 VF page for one Custom Object. I have 10 fields on the custom object each field should have one page at the end of my page I have to place Next button it should navigate to next page at page 11 I need to button to save all the previous 10 page values.how to achieve this in please share your answers


1 Answer 1


There you go, 10 pages where each of 10 fields has its own page and the 11th page has a save button:


<apex:page controller="My10FieldController" >
    <apex:form >
        <apex:inputfield value="{!obj[fields[i]]}" rendered="{!i < fields.size}"/>
        <apex:commandLink action="{!next}" value="Next" rendered="{!i < fields.size}"/>
        <apex:commandButton action="{!save}" value="Save" rendered="{!i = fields.size}"/>


public class My10FieldController{

    public list<String> fields {get; set;}
    public Integer i {get; set;}
    public CustomObject__c obj {get; set;}

    public My10FieldController(){
        i = 0;
        obj = new CustomObject__c();
        fields = new list<String>{

    public PageReference next(){
        i = i + 1;
        return new PageReference('/apex/My10FieldPage');

    public PageReference save(){
        insert obj;
        return new PageReference('/' + obj.Id);

Not the answer you're looking for? Browse other questions tagged or ask your own question.