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
GreenhouseGasGreenhouseGas 

How do I include a visualforce page in a tab.

I have a circumstance where I want to used the <apex:tabPanel component of visualforce, but instead of using a related list as the data in the tab I'd prefer to use a visualforce page.

 

For Example:  Below we have the Account page Tabbed, however I would like to make one of the tabs like the ones below,  open in a Visualforce page which has some tabled data that is called in through a custom controller. I am able to re-produce the typical Tabbed Account, but I do not know how to make one of the tabs open a visualforce page in the tab. Is this possible and how would I accomplish this? Any help would be appreciated.

 

Thanks

The Visualforce Page Editor, displaying an account detail page

AhmedPotAhmedPot

Hi,

 

you can either redirect to another VF page on tabenter/tab click or you can apex:iframe or apex:include to show another VF page in that tab

 

1. to redirect to another VF:

<apex:tab label="Verification" id="tabVerify1"   ontabenter="window.parent.location.replace('/apex/Verification_VF?id=006O0000001ro8BIAQ');">
        </apex:tab>


    2. to use apex:include to show contents of another page in your tab

   <apex:tab label="Verification2"  id="tabVerify"   ontabenter="window.parent.location.replace('/apex/Verification_VF?id=006O0000001ro8BIAQ');">
            <apex:include pageName="Verification_VF"/>
        </apex:tab>

 

Thanks,

Ahmed

Damien_Damien_

Alternatively, you can turn that other Visualforce page into a component instead.  That way you can use the same 'page' on several pages simply by adding a single line to a Visualforce page.  This would be the best solution to accomplish what you want.

 

sravusravu

If I am not wrong in understanding you requirement, when you go to setup -->App Setup --> Customize --> Account --> Buttons and Links.

 

In this you will find an edit link beside Account Tab, when you click on that it, you will be given an option to override the Accounts Tab with your visualforce page.

 

Is this what you are trying to do?

 

or else you can always create a custom visualforce tab.

GreenhouseGasGreenhouseGas

No I was looking more for the situation where I have a tabbed visualforce page, and I want one of the tabs to open a visualforce page.

 

Thanks

Damien_Damien_

Use either an iframe, or a build a component like I suggested earlier.

sravusravu

Hi,

 

Did you try what AhmedPot has suggested. <apex:pageinclude> should work but the in the page that you are referencing you should make sidebar = false and showheader=false so that the page will be rendered within the tab

lmarshlmarsh

I'm doing a similar project and was wondering how you determine what ID to use.  My tabs will be on the contact object so I know it will begin with 003, but what ID should I use in the code?

 

 

    2. to use apex:include to show contents of another page in your tab

   <apex:tab label="Verification2"  id="tabVerify"   ontabenter="window.parent.location.replace('/apex/Verification_VF?id=006O0000001ro8BIAQ');">
            <apex:include pageName="Verification_VF"/>
        </apex:tab>

 

Thank you

 

lmarshlmarsh

Additional question, I'm also wanting a tab for related list items such as Activities and Campaign History.  Can anyone recommend the best way to accomplish this?

 

Thank you

AdzimmerAdzimmer
Imarsh  ~ I just noticed your question and saw that no one ever answered. The code you are looking for is not as complex. Below are the codes to add For Activities and Campaign History in tabs:

Activities
<apex:tab label="Activity" name="Activity" id="tabActivity">
         <apex:relatedList subject="{!Contact}" list="ActivityHistories" />
</apex:tab>

Campaign History
<apex:tab label="Campaigns" name="Campaigns" id="tabCamp">
         <apex:relatedList subject="{!Contact}" list="CampaignMembers" />
 </apex:tab>
I am looking still for an answer to your earlier question from May 1, 2013...