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

Checkbox conditional equation that returns the sum of 2 fields.

Explorer ,
Feb 19, 2021 Feb 19, 2021

Copy link to clipboard

Copied

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

Views

372

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

Votes

Translate

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

LATEST

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

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