I asked this question on another forum, but I guess it would make a bit of sense to ask on a SalesForce forum. My goal is to have a checkbox field named "Inactive" and whenever the checkbox == false, "Inactive" will display as the default font color. When checkbox == True, "Inactive" will display as the color red.

My previous post yielded one response, in which using JavaScript was suggested. While I'm not the best at writing Java, the concept seems simple enough to try and write on my own.

I think I'm just struggling figuring out the specific placement in SalesForce, to begin writing the code. Also, are there multiple components to writing such code, or can I develop a simple piece of script and just have it run each time the value of the checkbox is changed.

Any suggestions would be greatly appreciated.

Thank you

1 Answer 1


If this is inside a Visualforce (VF) Page and you are using the standard VF tags to accomplish this with CSS and the styleClass attribute.

For example:

<apex:page standardController="object">
    <style type="text/css">
        .activeStyle { color: green; }
        .inactiveStyle {color: red;}

<apex:outputText value="{!object.Active__c}" styleClass="{!IF(object.Active__c,'inactiveStyle',activeStyle')}"/>

Guide on Custom Styles for Visualforce: http://www.salesforce.com/docs/developer/pages/Content/pages_styling_custom.htm

  • I will look into this ASAP and give that a try. Thank you for the quick response and additional link!
    – Steve
    Commented Jan 27, 2015 at 16:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .