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
Steve LovelySteve Lovely 

Hiding elements in visualforce page

Hello everyone, 
                         Im very new to visualforce and working on an output report. I have the report built and it is working. Almost too well. I am working with Cases and Work Orders. I am outputting a report that displays various milestones from the work order based on which status the case is set to. I would like to suppress all milestone text fields with the exception of 1 on the output. Is this possible?
AnudeepAnudeep (Salesforce Developers) 
If you are working with a visualforce page you need to conditionally render your fields

This can be achieved using a rendered attribute. See the example below
 
<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>

NOTE: The code provided is an example. You'll need to review and make modifications for your organization.

Let me know if this helps, if it does, please mark this answer as Best. It may help others in the community. Thank You!
Steve LovelySteve Lovely
Im still working with this attempting to get it to not render the fields I am looking for. I appreciate your patience