1 Reply Latest reply on Nov 3, 2008 1:01 PM by Andrew Elegante

    How to change active tabs in tabPanel?

    Amaris Nieves Newbie

      Im very new to Richfaces and I'd like to know if someone can give me an example of how I can change the active tab in a tabPanel when the user hits a form button.
      For example, I'd like to have previous and next buttons inside the tab and when the user clicks on the next button the active tab changes to the next tab.

      Thank you for your help.

        • 1. Re: How to change active tabs in tabPanel?
          Andrew Elegante Newbie

          I hacked together this javascript to do it on the client side. The 'pane' argument needs to be the id of the tabpanel your tabs are in. Most of the code was stripped for the richfaces js library for tab panel

          function selectNextTab(pane){
           var labelSuffix = "_lbl";
           var cellSuffix = "_cell";
           var shiftedTableSuffix = "_shifted";
           var contentSuffix = "";
           var tabs = RichFaces.panelTabs[pane];
           var FF = RichFaces_FF_Loaded;
           var found=false;
           for( var i=0; i<tabs.length; i++){
           var tabi = tabs;
           var tabId = tabi.id;
           var tabElement = $(tabId + contentSuffix);
           var tabLabelId = tabId +labelSuffix;
           var tabLabel = $(tabLabelId);
           var shiftedTable = $(tabId + shiftedTableSuffix);
           if(found && tabElement) {
           if(RichFaces.onTabChange(null,pane,tabId)) {
           if (RichFaces.isTabActive(tabLabelId)) {
           if(tabElement) {