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