You need to sign in to do that
Don't have an account?
mahesh p 54
after i click save on tab1 it need to insert fields in tab1 to custom object and should redirect to tab2 on same page
<apex:page controller="PassportController"> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js."></script> <script> $(window).load(function(){ $("#calYearPicker").html('') for(var i=1920;i<=2018;i++) { $("#calYearPicker").append("<option value'" + i +"'>" + i+ "</option>"); } }); </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.Given_Name__c}"> Firts Name + Middle Name</apex:inputField> <apex:inputField value="{!p.Surname_Max_45_Characters__c}"/> <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="{!save}" value="Save"/> </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="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab9"> <apex:form > <apex:inputFile value="{!file}" /> <apex:commandbutton action="{!upload}" value="Upload" /> </apex:form> </div> <div class="tabBox" id="tab10"> <apex:form > <apex:inputField value="{!pb.Passport_Slot_Holder_Name__c}" /> <apex:inputField value="{!pb.Passport_Slot_Availability__c}" /> <apex:commandbutton action="{!save}" value="Save" /> </apex:form> </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 Passport_Booking_Appointment__c pb { 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() { try { Display=true; samepage= [select id,Given_Name__c,Surname_Max_45_Characters__c,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 upsert p; i=i+1; if(i==1 ) { ApexPages.AddMessage(new ApexPages.Message(ApexPages.severity.CONFIRM,'Record Created Successfully.Thank you!')); //p=null; PageReference pg = new PageReference('/apex/Fresh_passport?id=' + p.Id + '#tab2'); pg.setRedirect(true); return pg; } /*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; }*/ } catch(Exception ex){ ApexPages.addMessages(ex); } return null; } public blob file { get; set; } public PageReference upload() { ContentVersion v = new ContentVersion(); v.versionData = file; v.title = 'testing upload'; v.pathOnClient ='/somepath.jpg'; insert v; return new PageReference('/' + v.id); } /*public PageReference saveBookings() { insert listBookings; //for(Integer i=0; i<listBookings.size(); i++) // { // insert listBookings; // } upsert c; upsert b; return Page.Allbookingssaved; }*/ }When i click save on tab1 it should insert all the fields in tab1 to custom object Passport_Application__c and need to redirect to tab2. After filling the details on tab2 the fields should get inserted into same custom object Passport_Application__c and should redirect to tab3. Is this possible? help me