How to Make a PDF Checkbox Read-Only Based on Drop-Down Selection
Question details
The user needs a method to dynamically disable a checkbox and change its background color in a PDF form when specific options are selected from a drop-down field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating interactive PDF forms where certain form fields (like checkboxes) need to be locked or unlocked based on user selections in other fields.
- Observed behavior
- Checkboxes need to become read-only with a gray background when specific drop-down options are chosen, and revert to selectable with a white background for other options.
Ensure your PDF document is open in a form-editing environment (such as Adobe Acrobat Pro) and that you have already created both the drop-down field and the target checkbox field on the page.
Add a Custom Calculation Script to the Drop-Down Field
Use a custom JavaScript snippet on the drop-down field to automatically evaluate the selection and toggle the read-only status and color of the target checkbox.
This approach uses a calculation script that triggers every time the drop-down value changes. It locates the specific checkbox field by its name and modifies its 'readonly' and 'fillColor' properties based on the drop-down's active value.
Note: If your checkbox field contains multiple widgets grouped under the same parent name, making the parent read-only will lock all checkboxes in that group. For mutually exclusive selections, consider using a radio button group instead.
Enter the form editing mode in your PDF editor. Right-click the drop-down field you want to use as the trigger and select 'Properties' from the context menu.
In the Properties dialog box, go to the 'Calculate' tab and select the 'Custom calculation script' option.
Click the 'Edit' button and enter the following script: var choice = event.value; var box = this.getField("YourCheckboxName"); if (choice == "A" || choice == "B" || choice == "C") { box.readonly = true; box.fillColor = ["G", 0.7]; } else { box.readonly = false; box.fillColor = color.white; }
Replace 'YourCheckboxName' with the exact name of your checkbox field. Replace 'A', 'B', and 'C' with the specific drop-down values that should trigger the lock. Click 'OK' to save the script.

Workaround for Single-Selection Checkboxes
If you want users to select only one checkbox at a time (like a radio button) and lock specific ones without locking the entire group, you must use unique field names.
Create and Manage Interactive PDF Forms with WPS Office
WPS Office provides a highly capable PDF editor that allows you to effortlessly design interactive forms, configure checkboxes, add drop-down menus, and manage form properties.
- 1. Open your PDF: Launch WPS Office and open your existing PDF document or create a new blank PDF.
- 2. Access form tools: Navigate to the 'Form' tab on the top ribbon menu to reveal all interactive form controls.
- 3. Add form fields: Click on 'Combo Box' to draw a drop-down menu or 'Check Box' to add tickable boxes to your document.
- 4. Edit field properties: Double-click any inserted field to open its properties panel, where you can define item lists, appearance settings, and actions.

Frequently Asked Questions
Why do all my checkboxes become read-only at the same time?
This happens if your checkboxes share the same field name. In PDF forms, fields with the same name are treated as a group (parent-child relationship). When the script makes the parent read-only, all child widgets become locked. To fix this, ensure each checkbox has a unique name, or use a radio button group instead.
How can I change the disabled checkbox to a custom color?
In your JavaScript code, you can modify the 'box.fillColor' property. The example uses ['G', 0.7] for light gray. You can change this to standard colors like 'color.red' or use an RGB array like ['RGB', 0.87, 0.87, 1] for a customized hue.
Where exactly do I paste the JavaScript code in the PDF editor?
You need to right-click the drop-down field (not the checkbox) and select Properties. Then, go to the Calculate tab, select 'Custom calculation script', click the Edit button, and paste your JavaScript code into the editor window.




