Jump to content

Conditionally change color of display field in details page


Recommended Posts

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,

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 7 years later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...