Ask Search:
Marcos MelladoMarcos Mellado 

How to set Tab as Active

Inside our partners portal, I created a Visualforce page displaying the documents tab. I did this to be able to create a custom tab with a different name (instead of content we needed a different name in the tab)

My code to create this Visualforce page is simply:

<apex:page action="/sfc/#search" tabStyle="partner_portal_tools__tab">
</apex:page>

The tab that contains this Visualforce page was setup as follows:

Tab Label: Search & Marketing Tools
Tab Name: partner_portal_tools
content: tools
Tab Style: People
Splash page custom link: None


However, when I access the Search & Marketing tools from the portal, the tab is not set as active. Am I doing something wrong?
Nebojsa ZgonjaninNebojsa Zgonjanin
Here you go:

Setting Tab Visibility

Available in: Enterprise, Unlimited, and Developer Editions

User Permissions Needed
To set tab visibility:“Manage Users”
  1. Click Your Name | Setup | Manage Users | Profiles.
  2. Select a profile.
  3. Depending on which user interface you're using, do one of the following:
    • Enhanced profile user interface—In the Find Settings... box, enter the name of the tab you want and select it from the list, then click Edit.
    • Original profile user interface—Click Edit, then scroll to the Tab Settings section.
  4. Specify the tab visibility.
    SettingDescription
    Default OnShow the tab by default for users with this profile. Individual users can override this setting. The Home tab setting can't be changed from Default On.
    Default OffHide the tab by default for users with this profile. Individual users can override this setting.
    Tab HiddenHide the tab and don't allow individual users to override this setting in their personal customization. Using this setting doesn't prevent users from accessing the records or list views from a tab; to prevent users from seeing records of that object type, remove the “Read” permission for the object.
  5. (Original profile user interface only) To reset users’ tab customizations to the tab visibility settings that you specify, select Overwrite users' personal tab customizations.
  6. Click Save.
Note
If Salesforce CRM Content is enabled for your organization but an administrator has not selected the Salesforce CRM Content User checkbox on the user detail page, the Salesforce CRM Content app has no tabs. The tabs display when the Salesforce CRM Content User checkbox is selected.
Marcos MelladoMarcos Mellado
NZgon, thanks for your reply, btu that's not what I'm looking for. The tab is being displayed without a problem. However, when I click on it to go to the section, it is not marked as active (it doesnt change color to indicate this is the tab that is being browsed.
Nebojsa ZgonjaninNebojsa Zgonjanin
You need to tell visual force page wich tab is going to be used.
see more here:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_page.htm 
tabStyleStringThe Salesforce object or custom Visualforce tab that controls the color, styling, and selected tab for this page. If using a custom object, the attribute must be specified with the developer name for the object. For example, to use the styling associated with MyCustomObject, use tabStyle="MyCustomObject__c". If a standard controller is specified, this defaults to the style of the associated controller; if a custom controller is defined, this defaults to the Home tab (if a custom controller). To use a custom Visualforce tab, set the attribute to the name (not label) of the tab followed by a double-underscore and the word tab. For example, to use the styling of a Visualforce tab with the name Source and a label Sources, use tabStyle="Source__tab". 10.0global
Marcos MelladoMarcos Mellado
That's what I'm trying to do, but it doesn't seem to be working, the instructions say:

"To use a custom Visualforce tab, set the attribute to the name (not label) of the tab followed by a double-underscore and the word tab. For example, to use the styling of a Visualforce tab with the name Source and a label Sources, use tabStyle="Source__tab"."

My code is 

<apex:page action="/sfc/#search" tabStyle="partner_portal_tools__tab">
</apex:page>

as you can see, the tabStyle I'm using is "partner_portal_tools__tab"

Then, my Visualforce Tab is:

Tab Label: Search & Marketing Tools
Tab Name: partner_portal_tools
content: tools
Tab Style: People
Splash page custom link: None

So I'm assuming it is correct, btu it doesn't seem to work. That's why I'm wondering if I did anything wrong :S

 
Nebojsa ZgonjaninNebojsa Zgonjanin
I just tried and got it working.
First: you need to add to profile security that it can use this visual force page and it will work when you click on it.
this is my code in VF page:

<apex:page tabStyle="partner_portal_tools__tab" standardStylesheets="true">
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
</apex:page>
Nebojsa ZgonjaninNebojsa Zgonjanin
-
 
 
 
 
 
 
Content Starts Here

Congratulations

 This is your new Page
Marcos MelladoMarcos Mellado
I don't know why it isn't working for me... do you think that my action attribute in VisualForce may be the reason why it isn't working? as you can see... my visualforce page simply displays the content section...
Nebojsa ZgonjaninNebojsa Zgonjanin
Try without action property.
You can execute it using java script on page load.
Marcos MelladoMarcos Mellado
How exactly would I execute the action with JS? The idea of this page is to display the content section in a custom tab.
Nebojsa ZgonjaninNebojsa Zgonjanin
Hello,

You are redirecting to standard page/functionality that already have set tab highlight for standard tab of Content section that is not present on your page.  
You are not able to get this working using this approach.

Try to recreate Search capability in VF page  or move it to Custom Links and use from side bar as tool without dedicated tab.

Regards,
Nash
Vernon BaasVernon Baas
I would like to add that I was having the exact same issues as mmellado.  I tried all of NZgon's suggestions to no avail.  

What finally resolved the issue for me was re-creating the Visualforce page tab with the "Default On" setting.  When I originally created the tab, I had chosen "Default Off" and even after resetting the permissions manually, the tab never displayed properly.