Skip to main content
davidp84650061
Participant
May 16, 2017
Question

New page woes!!

  • May 16, 2017
  • 1 reply
  • 283 views

Hi,

I am using a template to add pages to a document which works fine. I have some (48) field calculations to check a box if an input value is between a certain range. It works fine on page 1. I know it is not working because the field names in the calculation do not change with the new field names generated with the new page.

Here is the script I am using on Page 1:

var drop = this.getField.("InputText7");

var check = this.getField.("CheckBox1");

if(drop.value >= '0' && drop.value <= '0.25'){

check.checkThisBox(0,true);

}

else{

check.checkThisBox(0,false);

}

Is there a way to use this page and a field containing a part of the name in the calculation as going forward the fields on all the pages will contain "InputText7" and "CheckBox1" but with P1 and the name of the template added to it etc.

I am using Adobe Acrobat Pro.

Thanks in Advance.

David.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
May 16, 2017

- Drop the dot after getField, before the parentheses.

- Drop the quotes around the numbers in the if-conditions.

davidp84650061
Participant
May 16, 2017

Sorry about that, copy and paste error.

I have tried to use the endsWith function but to no avail!!

var drop = this.getField.endsWith("InputText7");

var check = this.getField.endsWith("CheckBox1");

if(drop.value >= 0 && drop.value <= 0.25){

check.checkThisBox(0,true);

}

else{

check.checkThisBox(0,false);

}

Am I on the right track?

try67
Community Expert
Community Expert
May 16, 2017

The first two lines should simply be:

var drop = this.getField("InputText7");

var check = this.getField("CheckBox1");