0

How to Hide/Show the fields based on Picklist value

Having Picklist (Device) and Value (A, B, C, D) having fields AA1, AA2, BB1, BB2, CC1, CC2 & DD1, DD2

If i will select value A from the picklist the AA2 will display and AA1 will hide.

If i will select value B from the picklist the BB2 will display and BB1 will hide.

If i will select value C from the picklist the CC2 will display and CC1 will hide.

If i will select value D from the picklist the DD2 will display and DD1 will hide.

I am using process builder on this for some other purpose. If it is possible to solve this issue without any code, please share the solution.

  • Do you want in vf page? looks like you have added apex tag in question – Ratan Paul Dec 2 '15 at 9:31
  • @Ratan - i am using all the above stuff in my standard object, without use of any code. – Nandu Raja Dec 2 '15 at 10:28
  • So, basically, a Dependant Picklist via Process Builder? – HomerJ Dec 2 '15 at 15:54
  • Sachin, if you are using the standard view and AA1, BB1, et al are fields then you cannot do what you need. Fields can't be shown/hidden dynamically from a standard page layout. If you want VF then you can. – Sebastian Kessel Dec 2 '15 at 16:04
  • @SebastianKessel any live example (code) can you share with me? – Nandu Raja Dec 2 '15 at 19:36
1

Sachin, per your comment in the OP, here is a sample on how to achieve this in Visualforce. I picked the account object, just pick a new object if you prefer. You also may want to make the screen "pretty". (By using pageBlockSections and the like)

<apex:page standardController="Account">

<apex:form id="theForm">

  <apex:inputfield value="{!Account.Device__c}">
    <apex:actionSupport event="onchange" reRender="theForm" />
</apex:inputField>

  <apex:inputField value="{!Account.AA2__c}" rendered="{!Account.Device__c == 'A'}" />
  <apex:inputField value="{!Account.AA1__c}" rendered="{! Account.Device__c != 'A'}" />

</apex:form>

</apex:page>

Let me know if you want me to make this example more complex, but it will give you an idea on how to approach the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.