Skip to main content
kwooden626
Participating Frequently
July 9, 2018
Question

Field value to determine which checkbox is selected

  • July 9, 2018
  • 1 reply
  • 902 views

Hello,

I'm trying to write a script to have one of four check boxes selected based on the value entered into a field.  I have pasted a picture of the portion of the PDF that I'm trying to write the script.  I want the "Grand Total" field to be the trigger so I put the following code into the custom validation script of this field.

this.getField("unqualified").checkThisBox(0, (event.value <="23"));

this.getField("marksman").checkThisBox(0, (event.value >="24") || (event.value <=28));

this.getField("sharpshooter").checkThisBox(0, (event.value >="29") || (event.value <=35));

this.getField("expert").checkThisBox(0, (event.value >="36"));

I'm unsure how to write the code for a number range (i.e. 24 - 28; 29 - 35) therefore multiple check boxes are selected using my code.  I need only one check box selected based on the "Grand Total" field.

This topic has been closed for replies.

1 reply

kwooden626
Participating Frequently
July 9, 2018

I did some more research on the internet and found that I only needed to replace "||" with "&&" and now the code works fine and only selects the correct checkbox.

try67
Community Expert
Community Expert
July 9, 2018

You should test it more carefully, because there are problems with your code.

You don't see a problem with this statement, for example?

(event.value >="29") && (event.value <=35)

kwooden626
Participating Frequently
July 9, 2018

I did more texting and do see a problem but I am unsure how to correct it.  Multiple boxes get checked when the Grand Total number goes up.