+ Start a Discussion
Nidhi Sharma 13Nidhi Sharma 13 

Input field visible if radio button option is yes

Hi,

I want that output label - "How many sub-projects" and input field be visible only when radio button "yes" is checked, otherwise invisible. How can I do it in VF

Thanks.

Please refer to code

<apex:pageBlockSection title="Project Details">
    
       <apex:panelGrid columns="2">
        <apex:outputLabel value="Project Name" for="gprojectName"/>
        <apex:inputField id="gprojectName" value="{!gproject.name}"/>
       </apex:panelGrid>
      </apex:pageBlockSection>
      <apex:pageBlockSection title="Decision">
       <apex:panelGrid columns="2">
          <apex:outputLabel value="Does it have sub-project(s)?" 
                           for="radiobtn"/>
          <apex:selectRadio id="radiobtn">
          <apex:selectOption id="radiobtn1" itemLabel="No" itemValue="1"></apex:selectOption>
          <apex:selectOption id="radiobtn2" itemLabel="Yes" itemValue="2"></apex:selectOption>
          </apex:selectRadio>
              
              <apex:outputLabel id="labid" value="How many sub-projects" for="gsubproject"/>
              <apex:inputField id="gsubproject" value="{!gproject.sub}"/>
                       
       </apex:panelGrid>
      </apex:pageBlockSection>