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
❤Code❤Code 

How to hide and display a inputtext field on lookup value selection

Hi All,


0down votefavorite

I have a vf page where I have a lookup field as Account.MyThunder__Account__c
and a inputtext field Account.MyThunder__Business_Hours__c.

I want if i select user as 'X' then text field should appear else remain hidden.

How can we achieve this scenario.
 
<apex:page standardController="Account" >
<apex:form >
<apex:pageBlock id="xxxpb1">

<apex:pageBlockSection>

<apex:actionRegion >               

  <apex:inputField id="xxxif1" value="{!Account.MyThunder__Account__c}" 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="{!Account.MyThunder__Business_Hours__c }" rendered="{!IF(Account.MyThunder__Account__r.Name =='United Oil & Gas Corp.',true,false)}"/>

</apex:pageBlockSection>


</apex:PageBlock>
</apex:form>    
</apex:page>