Jump to content
  • 0

Need help setting up conditional colored fields


Question

Hello,

I've been working with Caspio for a while now (Although I haven't done any real coding before), and I'm having trouble getting the coding right for something in a tabular report.

I have a report with roughly twenty fields and thousands of records. I have a yes/no field that determines whether records have been reviewed by an employee (they toggle it themselves).

I'm attempting to set it up to color code the records or even specific fields for that to make it easier to see if things have been dealt with or not.

This is the link I found that seemed to have what I needed. I don't have any experience with Javascript so if I'm making an obvious mistake I'm unaware of it.

https://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-dynamically-change-the-background-of-a-results-page/?_ga=2.268956409.901822134.1565024539-1632853601.1563754793

This is the code I've set up in an alternate HTML block based on the guide. We have an autonumber field 'Encounter_ID' and a yes/no for 'Needs_Review'

[@field:Needs_Review^]
<a id="visi[@field:Encounter_ID]">

<script>
var isi = document.getElementById("visi[@field:Encounter_ID]");
if('[@field:Needs_Review]' == 'Yes'){
isi.parentNode.parentNode.style.backgroundColor = '#FF9999';
}
else{
isi.parentNode.parentNode.style.backgroundColor = '#AAFAFA';
}
</script>

My issue is that when I input the code, it shows the entirety of it typed out without making any changes to the color.

If anyone could explain what I'm doing wrong, or suggest an alternative way to accomplish this, please let me know. I would greatly appreciate it.

Thanks in advance!

- Ryan
 

image.thumb.png.5f06d482871840e06e3fa64906ba753e.png

Link to post
Share on other sites

2 answers to this question

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.

Guest
Answer this question...

×   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...