PDF Editing Issues

Use an Acrobat Checkbox to Add a Proficiency Bonus with JavaScript

Kushani NimanthikaKushani Nimanthika Nov 19, 2026 868 views

Question details

Calculate an Athletics score using the Strength modifier and a proficiency bonus controlled by a checkbox.

Use an Acrobat Checkbox to Add a Proficiency Bonus with JavaScript
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A character-sheet PDF has fields for a Strength modifier, a proficiency bonus, and an Athletics proficiency checkbox.
Observed behavior
The Athletics score should always include the Strength modifier and include the proficiency bonus only when the checkbox is selected.
Before you start

Open the character-sheet PDF in Adobe Acrobat and check the exact names of the checkbox, Strength modifier, proficiency bonus, and Athletics result fields in Prepare a form. Make sure the two modifier fields contain numeric values.

Solution 1Recommended

Add a custom calculation script to the Athletics result field

Use this calculation to include the proficiency bonus only when the Athletics checkbox is selected.

The script treats the checkbox value "Off" as unchecked. Replace the example field names with the exact names in your PDF; field names are case-sensitive.

1
Open the result field properties

In Acrobat, open the PDF and select All tools > Prepare a form. Double-click the Athletics result field to open its properties.

2
Add the calculation

Open the Calculate tab, select Custom calculation script, and click Edit. Enter: var strength = Number(this.getField("strmod").value); var proficiency = Number(this.getField("Prob").value); var checked = this.getField("athc").valueAsString !== "Off"; event.value = strength + (checked ? proficiency : 0);

3
Test both checkbox states

Click OK and close the properties dialog, then use Preview in Prepare a form. Enter numeric modifiers and select and clear the Athletics checkbox; the result should change between Strength plus proficiency and Strength alone.

4
Save the PDF

Return from Preview and select File > Save to keep the calculation in the form.

Add a custom calculation script to the Athletics result field
If the result does not update: Check that Acrobat JavaScript is enabled in Preferences > JavaScript and that the field names and numeric values are correct. If the modifier fields are themselves calculated, check their calculation order in Prepare a form.
Free Microsoft Office alternative

Work with character-sheet PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for viewing PDFs and working with Office documents. Its format compatibility makes it easy to bring existing files into your workflow. Use Acrobat to create and test the checkbox JavaScript, as WPS does not fix Acrobat form scripts.

View character-sheet PDFs alongside your other documentsCompatible with Microsoft Office formats including DOCX, XLSX, and PPTXFamiliar interface for an easy transition from Microsoft OfficeFree, lightweight tools for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Where should I put the JavaScript in Acrobat?

In All tools > Prepare a form, open the Athletics result field's properties. On the Calculate tab, select Custom calculation script and click Edit.

How does the script know whether the checkbox is selected?

It checks the checkbox field's valueAsString against "Off". If the value is not "Off", the script adds the proficiency bonus.

What if my PDF uses different field names?

In Prepare a form, check each field's name in its properties, then replace "athc", "strmod", and "Prob" in the script with the exact names. Field names are case-sensitive.

Why is the calculated score incorrect or blank?

Check that the modifier fields contain numbers and that Acrobat JavaScript is enabled under Preferences > JavaScript. If the input fields are calculated, check their calculation order in Prepare a form.

Will every PDF viewer run the calculation?

PDF viewers vary in their support for Acrobat JavaScript. Test the saved form in the viewer where it will be used; a viewer that does not support the script may not update the score.