Skip to main content
Participant
March 24, 2020
Answered

Can a check box equate to a number?

  • March 24, 2020
  • 3 replies
  • 838 views

I'm trying to create a risk assessment form. Different risks have different numerical values. The user will see a form with check boxes, and check the boxes as they assess the risk moving down the form. Once complete- they will see a total score which can be used as a go/no-go guide.

 

I've seen how to use text boxes for numbers, and how to get totals, but can I do it with check boxes?

 

Thanks...

This topic has been closed for replies.
Correct answer JR Boulay

The Acrobat calculation function counts the "Off" values as zeros (or nothing).

 

3 replies

zs-gapAuthor
Participant
March 24, 2020

Thank you!

JR Boulay
Community Expert
JR BoulayCommunity ExpertCorrect answer
Community Expert
March 24, 2020

The Acrobat calculation function counts the "Off" values as zeros (or nothing).

 

Acrobate du PDF, InDesigner et Photoshopographe
Thom Parker
Community Expert
Community Expert
March 24, 2020

Yes, you can make the "Export" value of a checkbox a number.

However, adding checkboxes is a bit tricky since the unchecked value is "Off". So, the script must test for the "Off" value.

 

Here's a sample calculation script:

 

var sum = 0;

var oChkBx = this.getField("Check1");

if(oChkBx.value != "Off")

    sum += oChkBx.value;

 

... Repeat for all checkboxes ...

 

event.value = sum;

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often