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

Check and uncheck boxes script not working

New Here ,
Aug 27, 2024 Aug 27, 2024

Copy link to clipboard

Copied

I'm running into a problem where I have 4 sets of check boxes. 

set 1 is called Severity and there's options 1-4

set 2 is called Probability and there's options 1-4

set 3 is called Criticality and there's 16 options and is automatically checked based on selections from set 1 and set 2. (i.e. if you select 4 from Severity and 3 from Probability then it automatically checks 12 in Criticality)

set 4 is called AEM and has 3 options.

option 1 is automatically checked if 16, 12, or 9 is checked in set 3

option 2 is automatically checked if 8 or 6 is checked in set 3

option 3 is automatically checked if 4 or below is checked in set 3

 

The problem I'm running into is that if I manually check the boxes in set 3 then set 4's auto checking works. However if I make selection from sets 1 and 2 and it autochecks a box in set 3, then set 4 doesn't auto check.

 

Here's an example of what I have for the autocheck for set 3:

console.println(this.getField("Severity4").value);
console.println(this.getField("Probability4").value);
console.println(this.getField("Criticality16").value);
if (this.getField("Severity4").value != "Off" && this.getField("Probability4").value != "Off") {
this.getField("Criticality16").value = "Yes";
}
else {
this.getField("Criticality16").value = "Off";
}

 

and here's an example of what I have for the autocheck for set 4:

console.println(this.getField("Criticality16").value);
console.println(this.getField("Criticality12.1").value);
console.println(this.getField("Criticality12.2").value);
console.println(this.getField("Criticality9").value);
console.println(this.getField("Non-AEM").value);
if (this.getField("Criticality16").value != "Off" || this.getField("Criticality12.1").value != "Off" || this.getField("Criticality12.2").value != "Off" || this.getField("Criticality9").value != "Off") {
this.getField("Non-AEM").value = "Yes";
}
else {
this.getField("Non-AEM").value = "Off";
}

 

TOPICS
Acrobat SDK and JavaScript , Windows

Views

31

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 ,
Aug 27, 2024 Aug 27, 2024

Copy link to clipboard

Copied

LATEST

Where did you place those scripts?

If you place these in two different text fields as custom calculation scripts, you need to check field calculation order and make sure script for set3 runs before script for set4, or place both scripts in the same field.

 

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