0

Switching between Radio Option should show and hide Outputpanel. I got this working with following code:

     <apex:selectRadio id="benefitradioid" required="True" value="{!selectedTargetBenefit}" style="float:left;">
          <apex:selectOption itemLabel="SECOND" itemValue="secondvalue"/>
         <apex:selectOption itemLabel="THIRD" itemValue="thirdvalue"/>

         <apex:actionSupport action="{!setSpecifiedBenefitLevel}" reRender="myPanelID"/> 
</apex:selectRadio>

<apex:outputPanel id="myPanelID" rendered="{!showBenefitLevel}">
     <apex:inputText ----********************>
</apex:outputPanel>

and in Controller :

public void setSpecifiedBenefitLevel(){
   System.Debug('----'+selectedTargetBenefit);
    if(selectedTargetBenefit=='secondvalue'){
        showBenefitLevel=True'
    }
}

My debug logs doesn't show anything. What could be the issue or any changes I need to do ?

1 Answer 1

2

Found Solution !!! Following thing Worked Replace the Code

 <apex:outputPanel id="myPanelID" rendered="{!showBenefitLevel}">
              <apex:inputText ----********************>
       </apex:outputPanel>

with this one

<apex:outputPanel id="myPanelID">
    <apex:outputPanel id="myInnerPanelID" rendered="{!showBenefitLevel}">
          <apex:inputText ----********************>
   </apex:outputPanel>
</apex:outputPanel>
1
  • 1
    I believe the reason this works is that when an outputpanel is not rendered on the page, it literally doesn't exist on the page to be re-rendered. So you have to have an outer element that is rendered all the time and so will be addressable by the actionSupport. When that rerenders, the page re-evaluates the rendered= logic of everything inside it. Commented Dec 17, 2014 at 15:27

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.