Skip to main content
kwooden626
Participating Frequently
Jul 9, 2018 5:54 AM UTC
Question

Field value to determine which checkbox is selected

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 is closed to new replies. Start a new post to keep the conversation going.

9 replies

kwooden626
Participating Frequently
Jul 9, 2018 6:00 AM UTC

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.

Translate
try67
Community Expert
Community Expert
Jul 9, 2018 8:58 AM UTC

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)

Translate
kwooden626
Participating Frequently
Jul 9, 2018 10:38 AM UTC

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.

Translate