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

Hide dependent field when picklist value is none
Hi,
I created a VF page where, checkbox appears dependent on the value of the picklist. For Example
Picklist vlaues are: Meets Best Practices, Partially Meets Best Practices, Doesnot Meet Best Practices. For each Picklist value a checkbox appears. My Problem here is when the picklist value is "none" then all the checkbox appear. I want then to appear only when picklist value is selected and hide all checkbox when the picklist value is none.
Here is the code: <apex:pageBlockSection collapsible="false" columns="1" title="Instructional Material"> <apex:inputField value="{!Class__c.QC_Material_Observation__c}" required="false"> <apex:actionsupport event="onchange" rerender="null,best,partial,doesnot"/> </apex:inputField> <apex:outputPanel > </apex:outputPanel> <apex:outputPanel id="best" > <apex:pageBlockSection rendered="{!Contains(Class__c.QC_Material_Observation__c,'Meets Best Practices')}" > <apex:inputCheckbox value="{!Class__c.QC_IM_Fine__c}"/> <apex:inputCheckbox value="{!Class__c.QC_IM_Fine_Multimedia__c}"/> </apex:pageBlockSection> </apex:outputPanel> <apex:outputPanel id="partial" > <apex:pageBlockSection rendered="{!Contains(Class__c.QC_Material_Observation__c,'Partially Meets Best Practice')}" > <apex:inputCheckbox value="{!Class__c.QC_IM_Fine_Multimedia__c}"/> </apex:pageBlockSection> </apex:outputPanel> <apex:outputPanel id="doesnot" > <apex:pageBlockSection rendered="{!Contains(Class__c.QC_Material_Observation__c,'Does not Meet Best Practices')}" > <apex:inputCheckbox value="{!Class__c.QC_Third_Party_Material__c}"/> <apex:inputCheckbox value="{!Class__c.QC_No_Lectures__c}"/> </apex:pageBlockSection> </apex:outputPanel> </apex:outputPanel> <apex:inputTextarea value="{!Class__c.QC_Material_Comments__c}" required="false" rows="10" cols="50" /> <apex:inputField value="{!Class__c.QC_Material_Score__c}" required="false"/> </apex:pageblocksection>
Please add the condition to whether the picklist value is none in all pageblocksection and based on it render it
For ex :
<apex:pageBlockSection rendered="{!Class__c.QC_Material_Observation__c=='Meets Best Practices' }" >
similarly add this condition for other pageblock section tags.
Let me know if it didn't work
All Answers
Please add the condition to whether the picklist value is none in all pageblocksection and based on it render it
For ex :
<apex:pageBlockSection rendered="{!Class__c.QC_Material_Observation__c=='Meets Best Practices' }" >
similarly add this condition for other pageblock section tags.
Let me know if it didn't work
Hi
try this
Please remove this line in code.
It worked when i slightly changed the condition.
<apex:outputPanel id="best1" >
<apex:inputfield rendered="{!Class__c.QC_Material_Observation__c=='Meets Best Practices'}" >
<apex:inputCheckbox value="{!Class__c.QC_IM_Fine__c}"/>
<apex:inputCheckbox value="{!Class__c.QC_IM_Fine_Multimedia__c}"/>
</apex:inputfield>
</apex:outputPanel>
Now I dont see the checkboxes for "none" picklist !!! Yipee.. thanks a million
That Line is important to rerender. But yes I removed "Null " from that line. Thanks anyways