Jump to content
Sign in to follow this  
Carlson

Conditionally highlight Calendar Day Number

Recommended Posts

Hello,

I am using the following solution to conditionally highlight a calendar datapage.

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

I would like to modify this script so that I can highlight only the actual calendar day number and not the calendar day block. I am already highlighting the actual calendar day with this script below. I need to highlight the actual calendar day based on certain condition (like end of fiscal month). Does anyone know how I can modify to text-highlight in color the calendar day?

<script>
if('[@Yes/No FieldName]' == 'No'){
var isi = document.getElementById("visi[@field:UniqueFieldName]");
isi.style.display = 'none';
isi.parentNode.parentNode.style.backgroundImage = 'url("ImageURL")';
}
</script>

Share this post


Link to post
Share on other sites

In order to do this you can just use this  simple snippet of  code. 

document.getElementsByClassName("cbResultSetCalendarField")[x].style.backgroundColor="blue";

Where x is Number of Day of the monthe starting from 0 

Share this post


Link to post
Share on other sites

George,

Is there a way to modify this line below, so that it automatically points to that calendar day number? The line below automatically points to the calendar block, so I was hoping I could achieve similar without having to declare the calendar day #.

isi.parentNode.parentNode.style.backgroundColor = '#FFFF99';

 

Here is my script:

<script>
if('[@calcfield:1]' == 'Over / Uncorrected'){
var isi = document.getElementById("visi[@field:record_id]");
isi.parentNode.parentNode.style.backgroundColor = '#FFFF99';
}
else if('[@calcfield:1]' == 'Short / Uncorrected'){
var isi = document.getElementById("visi[@field:record_id]");
isi.parentNode.parentNode.style.backgroundColor = '#FFFF99';
}
else if('[@calcfield:1]' == 'Not Completed'){
var isi = document.getElementById("visi[@field:record_id]");
isi.parentNode.parentNode.style.backgroundColor = '#B0C4DE';
}
else if('[@calcfield:1]' == 'Past Due'){
var isi = document.getElementById("visi[@field:record_id]");
isi.parentNode.parentNode.style.backgroundColor = '#D8BFD8';
}
</script>

Share this post


Link to post
Share on other sites

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...
Sign in to follow this  

×
×
  • Create New...