Automatically Check a PDF Checkbox When Text Is Entered in Adobe Acrobat
Question details
Set up a PDF form to check a related checkbox when a user enters text or selects a radio button.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- A form uses a custom validation script to update a checkbox based on another field.
- Observed behavior
- The checkbox is not selected as expected when the related field is changed.
Open the form in Adobe Acrobat and use Prepare a Form to identify the exact name of the checkbox field. Confirm that JavaScript is enabled and that you can edit the text field's properties.
Use event.value in the text field's validation script
Use this fix when entering text should check a related checkbox.
During validation, event.value contains the value being validated. Using event.target.value may not give the new value at that point.
In Acrobat, open the PDF and choose Prepare a Form. Double-click the text field that should trigger the checkbox.
Select the Validate tab, choose Run custom validation script, and click Edit.
Enter: if (event.value != '') this.getField('Completed High School?').checkThisBox(0, true); Replace Completed High School? with the checkbox field's exact name.
Close the properties, leave form editing mode, enter text in the field, and move focus to another field. Check that the related checkbox is selected.

Work with PDF forms and Office files in WPS Office
WPS Office is a free, lightweight alternative for everyday document work, with a familiar interface and support for common Office formats to make migration easier. Its PDF tools offer another way to work with forms, but they do not fix Acrobat's validation script or guarantee support for its JavaScript behavior.

Frequently Asked Questions
Why should I use event.value instead of event.target.value?
In the text field's Validate script, event.value holds the value being validated. Use it to test the new text before checking the related field.
Where do I find the checkbox field name?
Choose Prepare a Form in Acrobat, then inspect the checkbox in the field list or double-click it and check its properties. Use the exact field name in this.getField().
Will the checkbox be cleared if I delete the text?
No. The example only checks the box when the value is nonempty. Add separate logic to uncheck it if that is the behavior your form needs.
Does this validation script also respond to a radio button?
No. The script runs when the text field is validated. Configure a separate action or script on the radio button if its selection should update the checkbox.
Why might the checkbox not update while I am still typing?
The validation script normally runs when the field is committed, such as when you move focus to another field. Enter text and then click another field to test it.




