wgalliance Posted July 22, 2016 Report Share Posted July 22, 2016 I would like to conditionally change the color of a display field on a detail page. I have a set of 9 fields that are all set as display fields. If the value is "Incomplete" I would like it to show up in RED text, otherwise nothing changes. I have read several of the forums but most of them refer to tabular reports or a field which the user updates. This is simply a details page with a display field. Thanks in advance, Quote Link to comment Share on other sites More sharing options...
MayMusic Posted July 25, 2016 Report Share Posted July 25, 2016 Same code should apply here: <div id="mydiv"> </div> <SCRIPT LANGUAGE="JavaScript"> if ("[@field:First_Name]" == "Incomplete"){ document.getElementById("mydiv").innerHTML ="<span style='color:red;'> [@field:First_Name] </span>"; } else{ document.getElementById("mydiv").innerHTML ="[@field:First_Name]"; } </SCRIPT> Select [@field:First_Name] from picker in the code above. It should be the field you want to conditionally change the color for. Quote Link to comment Share on other sites More sharing options...
wgalliance Posted August 1, 2016 Author Report Share Posted August 1, 2016 Thank you! I was able to add this and get the color to change dynamically for each instance. Quote Link to comment Share on other sites More sharing options...
MayMusic Posted August 1, 2016 Report Share Posted August 1, 2016 You are most welcome Quote Link to comment Share on other sites More sharing options...
Kurumi Posted September 29, 2023 Report Share Posted September 29, 2023 Hi - Just an update, for dynamically changing the font color of field values based on a condition - you can use this solution/CSS: https://howto.caspio.com/tech-tips-and-articles/dynamically-changing-colors-of-values/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.