Copy link to clipboard
Copied
All, I have the following fields; TC(total cost), MEL$, and SC. If TC >MEL$, I would want "EXCEED MEL" to populate the SC field in bold red font.
Thanks for everyones assistance in advance.
Use this as a calculation script in the SC field (not tested):
if (Number(this.getField("TC").value) > Number(this.getField("MEL$").value)) {
event.target.textColor = color.red;
event.target.textFont = font.HelvB;
}
else {
event.target.textColor = color.black;
event.target.textFont = font.Helv;
}
Available colors: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJS/color_properties.htm?rhhlterm=textcolor&rhsyns=%20
Copy link to clipboard
Copied
Is normaly "SC" field not in bold and red color?
Copy link to clipboard
Copied
No it is not. I will be adding other codes at a later date that will remain black.
Copy link to clipboard
Copied
Use this as a calculation script in the SC field (not tested):
if (Number(this.getField("TC").value) > Number(this.getField("MEL$").value)) {
event.target.textColor = color.red;
event.target.textFont = font.HelvB;
}
else {
event.target.textColor = color.black;
event.target.textFont = font.Helv;
}
Available colors: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJS/co...
Available fonts: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJS/Fi...
Copy link to clipboard
Copied
Thanks for this script. It works to bold the text but does not change font color.
Copy link to clipboard
Copied
Thanks JR Boulay. It is working now. I re-copied and pasted your script and it started working.