3

I want to change value of variable when user clicks on respective tab.

<apex:tabPanel switchType="client" value="{!currentTab}" id="theTabPanel">
   <apex:tab label="Step1: " name="one" id="tabOne">  
   </apex:tab>
   <apex:tab label="Step2: " name="two" id="tabTwo">  
   </apex:tab>
   <apex:tab label="Step3: " name="three" id="tabThree">  
   </apex:tab>
</apex:tabPanel>

If user clicks on step2 tab then currentTab=two.

1 Answer 1

4

I would try to use the "dummy" action function with a parameter, that is assigned to the apex variable. Then use the ontabenter attribute that triggers the action function if the user enters the current tab and sends the parameter to the variable:

<apex:tabPanel switchType="client" value="{!currentTab}" id="theTabPanel">
   <apex:tab label="Step1: " name="one" id="tabOne" ontabenter="changeValue('one');">  
   </apex:tab>
   <apex:tab label="Step2: " name="two" id="tabTwo" ontabenter="changeValue('two');">  
   </apex:tab>
   <apex:tab label="Step3: " name="three" id="tabThree" ontabenter="changeValue('three');">  
   </apex:tab>
</apex:tabPanel>


<apex:actionFunction name="changeValue" reRender="none">
    <apex:param name="p1" value="" assignTo="{!currentTab}" />
</apex:actionFunction>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .