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

Making Tabs active

I now have a fewTabs for  visualforce pages on my navigation bar.


The problem is that when I choose a page, that page's Tab does not become the active one.


What do I do to fix that?


Here is a sample page:

<apex:page standardController="Case" extensions="CaseExtension">
<apex:stylesheet value="{/Resources.ForteStyles.css}" />
.hv{text-align:left;font-size:1.2em; color: #1fbdf2;font-weight:bold;}
<apex:pageBlock title="My Requests" >
<apex:form >
<apex:dataTable value="{!cases}" var="s" columns="5" cellspacing="15" >
<apex:column headerValue="Request Number" headerClass="hv">
<apex:outputLink value="/apex/Viewed_Request?CaseNumber={!s.CaseNumber}">{! s.CaseNumber}</apex:outputLink>
<apex:column value="{! s.Subject}" headerValue="Subject" headerClass="hv" />
<apex:column value="{! s.CreatedDate}" headerValue="Date/Time Opened" headerClass="hv" />
<apex:column value="{! s.Ownerid}" headerValue="Request Owner" headerClass="hv" />

Best Answer chosen by Admin (Salesforce Developers) 
Neha LundNeha Lund

You need to give the API name



All Answers

with <apex:page> tag there is a attribute "tab style" put the tab name in it the tab style
Neha LundNeha Lund

<apex:page tabStyle="CustomObject__c">





You need to add tabStyle attribute in <apex:page> as:

Suppose you have a VF tab name "ShowRecords" and you need if you open a page this tab become active do this:

<apex:page tabStyle="ShowRecords__tab">



I tried the following:

 <apex:page standardController="Case" extensions="CaseExtension" tabStyle="My Requests">


But I get:

Error: Invalid tabStyle 'My Requests' specified. If you are trying to reference a custom Visualforce tab, you must append '__tab'.



I tried: 

<apex:page standardController="Case" extensions="CaseExtension" tabStyle="My Requests_tab">

and received the same error message.

thanks Neha for snippet
Neha LundNeha Lund

You need to give the API name



This was selected as the best answer
Neha LundNeha Lund



Neha LundNeha Lund

You have put only one underscore, put two..


Good to see now the days there are lot of people to help :)

i changed the name of the tab to be My_Requests_c


and this worked:  tabStyle="My_Requests_c__tab"


Thank you so much for your help


I now realize that this have also worked with:  tabStyle="My_Requests__tab"


What is the advantage of making the tab name: My_Requests_c