[SalesForce] : switch tab after a button click

I have an <apex:tabPanel> with several <apex:tab>.

In my first tab, I have an <apex:commandButton> and I want to switch to the second tab after a click on it. Is it possible ?

Here is my VisualForce page :

<apex:page>
 <apex:tabPanel>
     <apex:tab label="tab1" name="tab1" id="tab1">
         <apex:commandButton onclick="switchToSecondTab()"/>    
     </apex:tab>
     <apex:tab label="tab2" name="tab2" id="tab2">

     </apex:tab>
 </apex:tabPanel>

<script type="text/javascript">>
    function switchToSecondTab() {
        // What do I need to do here to switch to tab2 ?
    }
</script>
</apex:page>

Best Answer

Have u tried this [ http://www.infallibletechie.com/2013/02/blog-post.html ]

May this will help you !!!

Related Topic