You need to sign in to do that
Don't have an account?

Input Field visible only if radio button option "yes" checked
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
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>
You can use controller class with 2 steps:
1st create variable in class to set true/false based on checkbox selection.
Then , use rendered attribute on output label to the value of the above variable. So only when checkbox is select, rendered will be true and displayed.
this is an example of rendered a pageblock depending of some criteria