Copy link to clipboard
Copied
Ok i am setting a script that i need it to calculate a percentage. if the percentage is over 30% it needs to go to red, if it's below it can stay in black. i'm going off a V3/V4
V3-Payment
V4-Income
any ideas on how to get this setup for red?
This is what it's using right now with the Field Properties Format being Set to Percentage
(function () {
// Get the field values, as numbers
var v3 = +getField("payment").value;
var v4 = +getField("ApplicantsTotalNetIncome").value;
var v = v3 / v4;
if (!isNaN(v) && v4 != 0) {
event.value = v;
} else {
event.value = "";
}
})();
Copy link to clipboard
Copied
If you're trying to change the textColor and fillColor properties as mentioned many times in these forums. Here's a random post.
Copy link to clipboard
Copied
Change this part of the code:
if (!isNaN(v) && v4 != 0) {
event.value = v;
}
To this:
if (!isNaN(v) && v4 != 0) {
event.value = v;
event.target.textColor = (v>0.3) ? color.red : color.black;
}
PS. For future questions about scripts in Acrobat you'll be better off using this forum: JavaScript