Conditionally Format Boolean
- This topic has 3 replies, 2 voices, and was last updated 5 years, 9 months ago by .
Viewing 3 reply threads
Viewing 3 reply threads
- You must be logged in to reply to this topic.
Home › Forums › Classic DFFS › Conditionally Format Boolean
Tagged: boolean, conditionally, format
I’m using DFFS.
I’d like to conditionally format a yes/no Boolean slider background color to appear red if true/yes and gray if false/no. I tried Field CSS first
.spjs_boolean_slider {background:red}
but there’s no condition so it was always red. Then javascript but I can’t get that working either. Can you offer help?
Add this to your Custom CSS:
input:checked+.spjs_boolean_slider {
background-color:red;
}
Alexander
That worked perfectly, thank you so much! I did however notice on the edit form it was still blue, I’m assuming because I have it as a read-only field. Is there a way to get the red to appear with the field as read-only?
Sorry for the late reply – if you right click the readonly control and select “inspect” to open the developer tools you see that it has a class like this:
boolean_true+.spjs_boolean_slider
To override it you just add this to your Custom CSS:
.boolean_true+.spjs_boolean_slider{
background-color:red;
}
Alexander