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
mahesh p 54mahesh p 54 

how to insert/save all the field values into one custom object once all the tabs in the left are filled completely

<apex:page controller="PassportController" >        
    
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<style>
* {
  margin: 0;
  padding: 0;
}
.tabs {
  list-style: none;
  width: 200px;
  float: left
}

.tabs a {
  display: block;
  padding: 10px 15px;
  text-decoration: none;
  background: #fff;
  color: #000;   
  border-bottom: 1px solid #ccc;
}

.tabContent {
  margin-left: 200px;
  min-height: 300px;
  border: 1px solid #ccc;
  padding: 10px;
}

.tabs a.active {
  background: rgba(0,0,0,0.2);
}
.tabContent .tabBox {
  padding: 5px -5em;
  display: none
}
.tabContent .activeTab {
  display: block
}
</style>
<script>
$(document).ready(function(){
  $('.tabs a').click(function(){
    var tabId = $(this).attr('href');
    $('.tabs a').removeClass('active');
    $(this).addClass('active');
    $('.tabContent .tabBox').removeClass('activeTab');
    $(tabId).addClass('activeTab')
  });
});
</script>
<ul class="tabs" >
  <li><a class="active" href="#tab1">Applicant Details</a></li>
  <li><a href="#tab2">Family Details</a></li>
  <li><a href="#tab3">Present Residential Address</a></li>
  <li><a href="#tab4">Emergency Contact</a></li>
  <li><a href="#tab5">Identity Certificate/Passport Details</a></li>
  <li><a href="#tab6">Other Details</a></li>  
  <li><a href="#tab7">Passport Details Verification</a></li>  
  <li><a href="#tab8">Self Declaration</a></li>    
  <li><a href="#tab9">Upload Document</a></li>    
  <li><a href="#tab10">Book Appointment</a></li>    
</ul>  
<div class="tabContent">
  <div class="tabBox activeTab" id="tab1">    
    <apex:form >
        <apex:pageMessages />
        <apex:pageBlock>
            <apex:pageBlockSection columns="1" > 
                <apex:inputField value="{!p.Name}"/>
                <apex:inputField value="{!p.Gender__c}"/>
                <apex:inputField value="{!p.Date_of_Birth_DD_MM_YYYY__c}"/>
                <apex:inputField value="{!p.Place_of_Birth_Village_Town_City__c}"/>
                <apex:inputField value="{!p.Marital_Status__c}"/>
                <apex:inputField value="{!p.PAN_if_available__c}"/>
                <apex:inputField value="{!p.Voter_Id_if_available__c}"/>
                <apex:inputField value="{!p.Educational_qualification__c}"/>
                <apex:inputField value="{!p.Aadhaar_Number_if_available__c}"/>
            </apex:pageBlockSection>            
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton action="{!stdCntrlr.previous}" value="Previous" rendered="{!stdCntrlr.hasPrevious}"/>
                <apex:commandButton action="{!stdCntrlr.next}" value="Next" rendered="{!stdCntrlr.hasNext}"/>
            </apex:pageBlockButtons>

        </apex:pageBlock>
        
    </apex:form>
      </div>  
    
  <div class="tabBox" id="tab2">
       <apex:form >
        <apex:pageMessages />
        <apex:pageBlock>
            <apex:pageBlockSection columns="1" > 
                <apex:inputField value="{!p.Father_s_Name__c}"/>
                <apex:inputField value="{!p.Mother_s_Name__c}"/>
            </apex:pageBlockSection>            
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton action="{!stdCntrlr.previous}" value="Previous" rendered="{!stdCntrlr.hasPrevious}"/>
                <apex:commandButton action="{!stdCntrlr.next}" value="Next" rendered="{!stdCntrlr.hasNext}"/>
            </apex:pageBlockButtons>

        </apex:pageBlock>
        
    </apex:form>
  </div>
  <div class="tabBox" id="tab3">Tab Three</div>
  <div class="tabBox" id="tab4">Tab Four</div>
</div>
</apex:page>
public with sharing class PassportController {

    //Booking__c b=new Booking__c();
    //public list<Booking__c> listBookings{ get; set; }
    public Passport_Application__c p { get; set; }

    
    public ApexPages.StandardSetController stdCntrlr {get; set;}

    public PassportController(ApexPages.StandardSetController controller) {
    stdCntrlr = controller;
    }
    
    public Boolean Display{get;set;}

    public List<Passport_Application__c> samepage { get; set; }
    public List<Passport_Application__c> samepage1 { get; set; }
    public Integer i=0;
    public PassportController(){
        
        Display=false;
       p=new Passport_Application__c();
        //listBookings=new list<Booking__c>();
        //listBookings.add(b);
    }

    /*Public void addBookings()
        {
            Booking__c b = new Booking__c();
            listBookings.add(b);
        }
    */
    public PageReference save() {
        Display=true;
        
        samepage= [select id,Name,Gender__c,Date_of_Birth_DD_MM_YYYY__c,Place_of_Birth_Village_Town_City__c,Marital_Status__c,PAN_if_available__c,Voter_Id_if_available__c,Educational_qualification__c,Aadhaar_Number_if_available__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id
        samepage1= [select id,Father_s_Name__c,Mother_s_Name__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id
        //ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!'));
      
      
        upsert p;  
        	        
        
        if(i==0 && p.Name!=null && p.Name!='')
            {
                ApexPages.AddMessage(new ApexPages.Message(ApexPages.severity.CONFIRM,'Record Created Successfully.Thank you!'));
            }
        if(i==1)
            {
                ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Bookings are inserted Successfully.Thank you!'));
            }
        i=i+1;
        if(i==2)
        {
            PageReference pg = new PageReference(System.currentPageReference().getURL());
            pg.setRedirect(true);
            return pg;
        }

        return null;
    }
   }

all the fields belongs to one custom object Passport_Application__c but when tab applicant details is clicked the user need to fill all the field values which need to get inserted into Passport_Application__c  next button should redirect to family details and he should fill family details fields which also need to get inserted into Passport_Application__c but without disturbing the applicant details field values.