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

Tabbed Accounts with Tabs in Focus



I have used cook book version of tabbed accounts and wanted to extend that to my custom object as well.

I have a roadblock on getting the focus of the tabs.


What i want is whenever users select "Contact" tab and select New contact, after creation of new contact i want the user to get back to the contact tab and not default landing tab, which is 'detail' tab.


Any ideas on how to accomplish this?


VF Page:

<apex:page standardController="Account" showHeader="true" tabStyle="account" >
        .activeTab {background-color: #236FBD; color:white; background-image:none}
        .inactiveTab { background-color: lightgrey; color:black; background-image:none}
     <apex:tabPanel switchType="client" selectedTab=" tabdetails" id="AccountTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">  
       <apex:tab label="Details" name="AccDetails" id="tabdetails">
           <apex:detail relatedList="false" title="true"/>
        <apex:tab label="Contacts" name="Contacts" id="tabContact">
           <apex:relatedList subject="{!account}" list="contacts" />
        <apex:tab label="Opportunities" name="Opportunities" id="tabOpp">
          <apex:relatedList subject="{!account}" list="opportunities" />
        <apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct">
           <apex:relatedList subject="{!account}" list="OpenActivities" />
        <apex:tab label="Notes and Attachments" name="NotesAndAttachments" id="tabNoteAtt">
           <apex:relatedList subject="{!account}" list="NotesAndAttachments" />







One solution is to set the saveURL parameter on the new contact button to point to the page and pass a url parameter indicating which tab to activate.




On the controller you assign the parameter to a variable




And on the vf page you set the value to that


<apex:tabPanel switchType="client" value="{!activetab}" id="AccountTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">