The thought is to make the background color of the field red and the font black if it contains any value. Otherwise make it yellow/black. I also am aware of the different class names for numbers/dates.
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.
Question
Tubby
I am trying to use the script in this article: https://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-dynamically-change-the-background-of-a-results-page/ to a Details DataPage that I have. I am using the script for tabular reports. However, as it is designed for tables, it only applies the script to a single field. I have basic understanding of scripts but not by much so I am struggling to modify it and use it on my DataPage.
Current Script that is only applying to a single field:
<script>document.addEventListener('DataPageReady', function (event) {
var isi = document.querySelectorAll("div[class*='cbFormBlock1'] span");
[].forEach.call(isi, function(isi, i) {
if( isi.innerHTML != ' '){
isi.parentNode.style.backgroundColor = 'yellow';
isi.parentNode.style.color= 'black';
}
else{
isi.parentNode.style.backgroundColor = 'red';
isi.parentNode.style.color= 'black';
}
});
});
</script>
The thought is to make the background color of the field red and the font black if it contains any value. Otherwise make it yellow/black. I also am aware of the different class names for numbers/dates.
Any ideas are welcome. Thank you!
Link to comment
Share on other sites
10 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.