Navigate to Form setting focus to a certain tab. RRS feed

  • Question

  • I have a custom app in an iframe on the account form.  The custom page displays links to related accounts.   The links navigate back to the same page, but with the different account GUID.  The problem is I want to be back on the tab that contains the Iframe, not the first tab.   How can I change which tab is displayed?  I could add an extra query parameter to the url, but How do change focus to the tab I want to be on?  Can this be done in the OnLoad event?

    Wednesday, October 20, 2010 8:40 PM


  • Hi Marc,

    Besides sending query parameters, you may also want to try storing your tab state in cookie by hooking an event to the tab you want to track.

    Store tab state

    // Attach event to the tab you want to track
    var tabControl = crmForm.all.tab1Tab;
    if (typeof(tabControl) != "undefined" && tabControl != null)
     tabControl.attachEvent('onclick',trackTab, false);
    function trackTab()
     // Store information in cookie
     document.cookie = window.name + "=tab1"; 

    Retrieve tab state and switch tab
    // Retrieve cookie
    var hasCookie = document.cookie.indexOf(window.name + "=tab1");
    if (hasCookie != -1)
     // Code to switch to the tab we want
     var tab = document.getElementById("tab1Tab"); 
     if (tab) tab.click();

    Hope this helps.


    Thursday, November 4, 2010 3:39 PM