function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Srinivas TestingSrinivas Testing 

Hide the two text field in child record based on parent record picklist value in VF page

HI,
How to hide or greyed out of 2 text field in the child record based on parent record picklist value in VF Page? Can anyone help me?

Thanks,
Srini
Raj VakatiRaj Vakati
Use this code
 
<apex:pageBlock id="xxxpb1">

<apex:pageBlockSection>
                    
<apex:actionRegion >               

  <apex:inputField id="xxxif1" value="{!Object.picklistfieldapiname1}" required="true" >

     <apex:actionSupport event="onchange" rerender="xxxpb1" />
  </apex:inputField>

</apex:actionRegion>
                 
</apex:pageBlockSection>
               
<apex:pageBlockSection id="xxxpbs1" rendered="true">

 <apex:inputField id="xxxif2" value="{!Object.Fieldtobedisplayed1}" rendered="{!IF(Object.picklistfieldapiname1 ='picklist value 1' || lead.Buyer_Type__c ='picklist value 2' ,true,false)}"/>

</apex:pageBlockSection>

<apex:pageBlockSection id="xxxpbs2" rendered="true">

  <apex:inputField id="xxxif3" value="{!Object.Fieldtobedisplayed2}" rendered="{!IF(Object.picklistfieldapiname1 ='picklist value 3' || lead.Buyer_Type__c ='picklist value 4' ,true,false)}"/>  
                                                                     
</apex:pageBlockSection>

</apex:PageBlock>

 
Raj VakatiRaj Vakati
https://help.salesforce.com/articleView?id=000003854&type=1