Change text color in multiple fields based on expired date.
Hi friends,
Im in Acrobat Pro DC and I have multiple fields that I want to turn the text red if the "Expires" cell is any day before today.Expired.
I have a field that already calculates the current date from a Document level script; Today_af_date. Here is that code:
function dateToday() {
var d = new Date();
f = this.getField("Today_af_date");
f.value = d;
}
dateToday();
Here is the code that is in Custom Val Script: of the "Expires" cell - NOTE: I have 52 fields that I need this entered into. Should it be a Document level script?
I'm getting a Syntax error 19 at line 20, as well?
var Today = this.getField("Today_af_date").value;
var Expired = event.value;
// Check to see if the cells are filled with data
if(Today.length || Expired.length) {
// Make sure date values are the same
var dateToday = util.scand("mm/dd/yy", Today);
var dateExpired = util.scad("mm/dd/yy",Expired);
// Fire off the validation
if (dateExpired.value<=dateToday.value);{
event.target.textColor = color.red;
this.getField("docLicense.0").textColor = color.red;
this.getField("docLicenseNumber.0").textColor = color.red;
this.getField("docIssueDate.0").textColor = color.red;}
// Change them back to black if the Expired Date is changed to Non-Expired
else{
event.target.textColor = color.black;
this.getField("docLicense.0").textColor = color.black;
this.getField("docLicenseNumber.0").textColor = color.black;
this.getField("docIssueDate.0").textColor = color.black;}
}
