• Katelyn McGovern
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I have multiple 'yes' 'no' checkbox on VF page and I am trying to display text field when 'Yes' checkbox is clicked but not in all case.
I need to display text field for some of the checkbox. How to make use of this code and identify which checkbox is selected and based
on that I can display the textbox.
<apex:pageblocksection >

            <apex:inputcheckbox value="{!chkBx}" label="Yes"> 
                <apex:actionSupport event="onchange" rerender="thePanel" action="{!click}"/>    
            </apex:inputcheckbox> 
           <apex:inputCheckbox label="No"/>  
</apex:pageblocksection>




<apex:pageblocksection >
 <apex:outputPanel id="thePanel">    
                <apex:pageBlockSectionItem rendered="{!displayInputputText}">
                    <apex:outputLabel value="Input Text" />
                    <apex:inputText value="{!input}"/>  
                </apex:pageBlockSectionItem>
            </apex:outputPanel>
</apex:pageblocksection>
 
public Boolean displayInputputText{get;set;}
    public Boolean chkBx{get;set;}
    public String input{get;set;}       
    public PageReference click(){    
         if(chkBx){
             displayInputputText = true;
         }
         else{
             displayInputputText = false;
         }
         return null;