Skip to main content
Inspiring
May 12, 2025
Question

Looping Through Specific Array of Fields and Checking Box Based on Field Values

  • May 12, 2025
  • 1 reply
  • 205 views

I have an array of 30 fields "Price01 - Price30" and checkbox.  I am trying to loop through each field to see if it is greater than $100.  If at least one of the 30 fields has a value greater than 100, I want the box to be checked.  If not, then the box is unchecked.

 

So far I have the following validation script in each of the fields because checkboxes don't allow for validation scripts

var a = this.getField("Price01").valueAsString;
var b = this.getField("Price02").valueAsString;
var c = this.getField("Price03").valueAsString;
var d = this.getField("Price04").valueAsString;
var e = this.getField("Price05").valueAsString;

if (a >= "100" || b >= "100" || c >= "100" || d >= "100" || e >= "100")
{
		this.getField("TestBox").checkThisBox(0,event.value < 100 ? false : true);
    }


else {
    
	}
 

1 reply

JR Boulay
Community Expert
Community Expert
May 12, 2025

[MOVED TO THE ACROBAT DISCUSSIONS]

Acrobate du PDF, InDesigner et Photoshopographe
MBChelsAuthor
Inspiring
May 12, 2025
Can you just please delete it because I already reposted in Acrobat
discussion?