+ Start a Discussion
sampath pallisampath palli 

How to create different vf pages as tabs

Hi 
I have an requirement that i need to make different vf pages as tabs for example
i have created 4 vf pages with different components like input&output. I need to make these pages as tabs for a site

Thanks in Advance 
Mahesh DMahesh D
Hi Sampath,

Using the Visualforce Component as a tab and you can create on VF page with 4 tabs and each tab will contain a specific component.

You can try below solutions:

http://salesforce.stackexchange.com/questions/10227/vf-pages-as-tabs-with-in-a-main-vf-page-including-multiple-vf-pages

https://developer.salesforce.com/forums/?id=906F000000096qaIAA


Please do let me know if it helps you.

Regards,
Mahesh
JyothsnaJyothsna (Salesforce Developers) 
Hi Sampath,

You can achieve the above scenario by using Visualforce component.
Please check the below sample code.

VisualForce Page
<apex:page >
 
 <apex:tabPanel >
 <apex:tab label="Customer Information">
 <fieldset>
 <legend>customer details </legend>
 <c:tabbedviewcomp1 ></c:tabbedviewcomp1>
 </fieldset>
 </apex:tab>
 <apex:tab label="Address">
 <fieldset>
 <legend>Address</legend>
 <c:tabbedviewcomp2 ></c:tabbedviewcomp2>
 </fieldset>
 </apex:tab>
 </apex:tabPanel>
 
</apex:page>

Visualforce Component
 
<apex:component controller="tab2control">
  <apex:form >
  <apex:pageBlock >
  <apex:pageBlockButtons location="bottom">
  <apex:commandButton value="Save" action="{!save1}"/>
  </apex:pageBlockButtons>
  <table cellspacing='15'>
  <tr><th>Billing Street</th>
<td>  <apex:inputField value="{!c.Billing_Street__c}"/></td>
<th>billing city</th>
<td><apex:inputField value="{!c.Billing_City__c}"/></td></tr>
  </table>
  </apex:pageBlock>
  </apex:form>
</apex:component>

Output Preview

User-added image
 

Hope this helps you!
Best Regards,
Jyothsna
Galeeb SKGaleeb SK
what we write in controller class