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

How to highlight a page block section based on a field value ?

Suppose I have multiple page block sections on my VF page created for Account object.

I want a solution to highlight a particular page block section based on a particular field value.


( Please Note :

I am aware of rendering a page block section based in a field value.

All I need is to highlight it based on a field value.




Thanks in advance,



The easiest way I can think of is this:  wrap the pageBlockSection in an outputPanel and give the outputPanel a styleClass attribute that you use to highlight the section.



    <apex:outputPanel styleClass="{!stylingFieldInController}">

        <apex:pageBlockSection ... styleClass="{!}"> ... </apex:pageBlockSection>




    public String stylingFieldInController {get; set { stylingFieldInController = 'myStyleClass' } }



    .myStyleClass { background-color: yellow; }