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

Checkbox conditional equation that returns the sum of 2 fields.

Explorer ,
Feb 19, 2021 Feb 19, 2021

Hello, 

I am looking to achieve this several times over 'if "checkbox" is checked, value is sum of "fieldA" and "fieldB", else value is "fieldA"'

The formula I put into the Custom calc script is:

var x = this.getField("IntB").value;
var y = this.getField("ProfB").value;
var z = this.getField("Check Box 12").value;
if(z == "Yes")
{

event.value = x + y;
}else{
event.target.value= x;

}

I don't receive an error, but the field remains blank. Any help would be greatly appreciated!

 

TOPICS
Acrobat SDK and JavaScript , Windows
571
Translate
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 , Feb 19, 2021 Feb 19, 2021

Change:

event.target.value= x;

To:

event.value= x;

 

And also check the JS Console for error messages after editing the value of one of the fields.

Translate
Community Expert ,
Feb 19, 2021 Feb 19, 2021

Change:

event.target.value= x;

To:

event.value= x;

 

And also check the JS Console for error messages after editing the value of one of the fields.

Translate
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
Explorer ,
Feb 27, 2021 Feb 27, 2021
LATEST

Thank you so much for your reply. I didn't recieve a notification until today. I appreciate your timely response!

Translate
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