Change border colour of Text field based on Date Field - Calculated Field | Community
Skip to main content
Missile64
Level 2
November 21, 2022
Solved

Change border colour of Text field based on Date Field - Calculated Field

  • November 21, 2022
  • 2 replies
  • 729 views

I have a list of documents that require periodic reviews. I would like to have a Calculated field that adds a Red border on the Title field when the Review Date field is =< Today, and Amber if the Review Date field is Today -1 Month.

JS is not allowed hence the need for a Calculated field.

Title - Text Filed Review Date - Date Field Todays Date 21-11-2022
Document 1 25-10-2022 Red border because it is past Review Date
Document 2 12-12-2022 Amber border because it is within 1 month of Review Date
Document 3 20-02-2023 Nothing as it is over 1 month from Review Date

 

Thanks in advance
Pete

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Vijay_Katoch

You can achieve this by putting javascript something like below in the calculate event of the field whose border color need to change:

 

if(CallFunctionToCompareDateWhichReturnTrueOrFalse(putCurrentDate,DateofYourField)){
this.border.edge.color.value="255,0,0";
}else{
this.border.edge.color.value="255,255,0";
}

2 replies

Vijay_Katoch
Community Advisor
Vijay_KatochCommunity AdvisorAccepted solution
Community Advisor
November 21, 2022

You can achieve this by putting javascript something like below in the calculate event of the field whose border color need to change:

 

if(CallFunctionToCompareDateWhichReturnTrueOrFalse(putCurrentDate,DateofYourField)){
this.border.edge.color.value="255,0,0";
}else{
this.border.edge.color.value="255,255,0";
}

Mayank_Gandhi
Adobe Employee
Adobe Employee
November 21, 2022

sample :


xfa.resolveNode("form1.#subform.TextField1").border.edge.color.value="255,0,0"

 

https://help.adobe.com/en_US/livecycle/10.0/DesignerHelp/WS92d06802c76abadbe98a8d5129b8b01f08-7fe2.html

 

@missile64