PDF Editing Issues

How to Make a PDF Checkbox Read-Only Based on Drop-Down Selection

Elise WilliamsElise Williams Nov 3, 2026 869 views

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.

How to Make a PDF Checkbox Read-Only Based on Drop-Down Selection
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.
Before you start

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.

Solution 1Recommended

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.

1
Open drop-down properties

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.

2
Navigate to the Calculate tab

In the Properties dialog box, go to the 'Calculate' tab and select the 'Custom calculation script' option.

3
Insert the JavaScript code

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; }

4
Customize the field names and values

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.

Add a Custom Calculation Script to the Drop-Down Field
Customizing the disabled color: The array ['G', 0.7] represents a grayscale color (light gray). If you prefer a different disabled color, you can use an RGB array such as ['RGB', 0.8, 0.8, 0.8].
Advanced PDF Form Editing

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. 1. Open your PDF: Launch WPS Office and open your existing PDF document or create a new blank PDF.
  2. 2. Access form tools: Navigate to the 'Form' tab on the top ribbon menu to reveal all interactive form controls.
  3. 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. 4. Edit field properties: Double-click any inserted field to open its properties panel, where you can define item lists, appearance settings, and actions.
Easily insert and customize form fields like drop-downs, text boxes, and checkboxes.Fully compatible with standard PDF form structures and properties.Lightweight, fast, and free alternative to expensive PDF editing software.Cross-platform support ensures your interactive forms work seamlessly on Windows, Mac, and mobile.
microsoft office alternative - wps office

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.