You need to sign in to do that
Don't have an account?
Josh Gallagher
How to hide a field based on picklists
I am trying to create an invisible picklist called "Subcommittee" and only when certain values in "Type" and "Subtype" fields are picked. Then the Subcommittee picklist will appear and they can choose their selection. I know this has to be done by VF.
Please see my current code
VisualForce Page:
<apex:page standardController="Case" extensions="customCaseController" id="pg">
<apex:form id="frm">
<apex:pageblock id="pb">
<apex:pageBlockSection id="pbs" columns="2" title="Information">
<apex:inputField value="{!theCase.Type}"/>
<apex:inputField value="{!theCase.SubType__c}"/>
<apex:inputField value="{!theCase.Subcommittee__c}" rendered="{!!isVisible}"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
Apex Classes:
public with sharing class customCaseController {
public Case theCase {get;set;}
public boolean isVisible{get;set;}
public customCaseController(ApexPages.StandardController stdcontroller) {
isVisible = false;
String AccountId = ApexPages.currentPage().getParameters().get('id');
if(CaseId != null){
Schema.DescribeSObjectResult r = Case.sObjectType.getDescribe();
theCase = (Case) stdController.getRecord();
if(theCase != null){
if(theCase.Type == 'Advisory Committee' && (theCase.SubType__c == 'EAC'))
isVisible = true;
}
}
}
}