• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

If/Then statement between 3 fields.

Community Beginner ,
Jun 14, 2021 Jun 14, 2021

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.

TOPICS
JavaScript

Views

874

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 15, 2021 Jun 15, 2021

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

 

Available fonts: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJS/Field_properties.htm?rhhlterm=textcolor&rhsyns=%20#XREF_11104_textFont

Votes

Translate

Translate
Enthusiast ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

Is normaly "SC" field not in bold and red color?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

No it is not. I will be adding other codes at a later date that will remain black.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2021 Jun 15, 2021

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...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

Thanks for this script. It works to bold the text but does not change font color.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

LATEST

Thanks JR Boulay. It is working now. I re-copied and pasted your script and it started working.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines