+ Start a Discussion

Conditional TabPanel based on ProfileId

I'm trying to determine the default tab of a TabPanel based on ProfileID, but I can't figure it out. Here's the code in my page, with the If statement based on Profile.


<apex:tabPanel switchType="client" selectedTab="{!if($User.ProfileId!='00e00000006ore5', 'name5', 'name2')}"
tabClass="activeTab" inactiveTabClass="inactiveTab">


Basically for the default selectedTab, if the profile isn't the hardcoded id, I want it to show "name5", otherwise show "name2".


If I hardcode "name5" in, it works. I've also tried using {!$Profile.Name}.


Any help is appreciated.








  Using rendered you can achieve this



  <apex:tabPanel switchType="client" selectedTab="tabName5"   tabClass="activeTab" inactiveTabClass="inactiveTab">
 <apex:tab label="name5" name="tabName5" id="tabName5" rendered="{!User.ProfileId='00e00000006ore5'}" >
 <apex:tab label="name2" name="tabName2" id="tabName2" rendered="{!User.ProfileId='Give Name 2 ID'}" >



That would work if I only want to render one tab for a certain profile, but I'm trying to determine which is the DEFAULT tab that is shown. I still want all tabs to be shown for everyone, but for different profiles, have a different tab that is the active one on default.


Like this:


Tab 1 - Default for Profile A, but sees Tabs 1-4

Tab 2 - Default for Profile B, but sees Tabs 1-4

Tab 3 - Default for Profile C, but sees Tabs 1-4

Tab 4 - Default for Profile D, but sees Tabs 1-4