+ Start a Discussion
csbaacsbaa 

switch to another TAB by code

Hello Helpers

I have a visual force page  with 2  tabs

On tab  1 I  have some components  like  grids  and customr button

I would like  to   switch automatically  from Tab 1  to Tab 2  when I press the custom button BUT ONLY AFTER  the apex controller method  associated to  custom buton Action has  completed

I tried  to use  oncomplete  to achieve this.  My problem is  that the tab  is switched but  it looks  like the operation  in DoSonethingatApexside  is not performed

     <apex:pageBlockButtons >
     <apex:commandButton action="{!DoSonethingatApexside}" value="Preview"            
     oncomplete="RichFaces.switchTab('{!$Component.theTabPanel}','{!$Component.tabPreview}','Preview')">
     </apex:commandButton> 
     </apex:pageBlockButtons> 


If  I remove the oncomplete  and press the custom button and switch tomTab 2  manually  all Are OK
I see in tab 2  the results  of the custom button action

any suggestions?


Thanks in adsvance
csbaa


Best Answer chosen by csbaa
Shrikant BagalShrikant Bagal
to use "oncomplete" attaribute, you have to use reRender attaribute with commandButton.