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
tpasley@yahoo.comtpasley@yahoo.com 

outputLink Tab on refresh

I have simple visualforce page on a custom tab with several outputLinks to other pages.  I want the links to keep the same tab highlighted.  I have tried using tabStyle to set it to the controller for these pages, but it doesn't work; a different tab is highlighted.  Sometimes it's another custom tab and sometimes it's the Home tab.  Here is the page:

 

 

<apex:page showHeader="true" sidebar="true" tabStyle="My_Reports__tab" title="My Reports" controller="UserReportController" id="MyReports" >
    <apex:sectionHeader subtitle="Your Reports"/>
    <apex:pageBlock rendered="{!OR(isPortalUser, isLeadAgent, isTheUser)}">
    
        <div style="margin: 2px; padding: 2px; width: 90%; background: url('{!$Resource.MyLogo}') no-repeat;">
            <div style="font-weight: bolder; font-size: larger; margin-left: 150px;">
            
            <apex:outputLink value="/apex/monthlyReport">Individual Organization Reports</apex:outputLink><br/>
            <apex:outputLink value="/apex/BatchReport">Coalition Report</apex:outputLink><br/>
            <apex:outputLink value="/apex/TransferVerification">Transfer Verification Report</apex:outputLink><br/>
            <apex:outputLink value="/apex/UnderConstruction">Summary Report</apex:outputLink><br/>
            <apex:outputLink value="/apex/UnderConstruction">Progress on Goals Report</apex:outputLink><br/>
            <br/><br/><br/><br/><br/>
            </div>
        </div>
    </apex:pageBlock>
    <apex:pageBlock rendered="{!AND(NOT(isPortalUser), NOT(isLeadAgent), NOT(isTheUser))}">
        <apex:outputText style="font-weight: bolder;font-size: largest;">You are not authorized to view the reports.</apex:outputText>
    </apex:pageBlock>
   <br/>
</apex:page>

 

 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

The <apex:page ... declarations listed above are one per target page.

 

I.e. when you use a command link of:

 

 

 <apex:outputLink value="/apex/TransferVerification">Transfer Verification Report</apex:outputLink><br/>

 

 

your TransferVerification page needs to declare the tabstyle of:

 

 

<apex:page tabStyle="My_Reports__tab__c"

 

 

and the same applies to all the other target pages of command links.

 

 

All Answers

SSRS2SSRS2

To keep same tabStyle is to be highlighted put tabStyle attribute with same tabStyle value(My_Reports__tab__c) for all your custom pages listed in output links. 

Ex:

 

<apex:page tabStyle="My_Reports__tab__c" ...> for monthlyReport page
<apex:page tabStyle="My_Reports__tab__c" ...> for BatchReport page
<apex:page tabStyle="My_Reports__tab__c" ...> for TransferVerification page
<apex:page tabStyle="My_Reports__tab__c" ...> for UnderConstruction page

-Suresh

 

tpasley@yahoo.comtpasley@yahoo.com

I can't have more than one <apex:page> tag on a single visualforce page.  I tried adding the For clause for one of the page links, but that also did not work.  

 

The documentation states the following to keep the focus on a custom visualforce tab (which is what I want and which is what I tried to do in the code):  

 

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".

bob_buzzardbob_buzzard

The <apex:page ... declarations listed above are one per target page.

 

I.e. when you use a command link of:

 

 

 <apex:outputLink value="/apex/TransferVerification">Transfer Verification Report</apex:outputLink><br/>

 

 

your TransferVerification page needs to declare the tabstyle of:

 

 

<apex:page tabStyle="My_Reports__tab__c"

 

 

and the same applies to all the other target pages of command links.

 

 

This was selected as the best answer
tpasley@yahoo.comtpasley@yahoo.com

Perfect.  Thanks for the clarification. 

 

Thank you, Suresh, too.