PDF Editing Issues

How to Get the Fill Color of a Selected Acrobat Radio Button

Anum MushtaqAnum Mushtaq Nov 5, 2026 869 views

Question details

The user needs to retrieve the fill color of the currently selected radio button in a PDF form.

How to Get the Fill Color of a Selected Acrobat Radio Button
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Using JavaScript to read appearance properties of form fields in a PDF document.
Observed behavior
Acrobat's fillColor property returns the color of the first option field in the group rather than the color of the currently selected radio button.
Before you start

Ensure you have access to the PDF's JavaScript console or form field calculation scripts, as retrieving specific widget properties requires custom scripting.

Solution 1Recommended

Assign Color Based on the Selected Export Value

Since the fillColor property targets the first widget by default, use a script to check the event.target.value and manually assign or read the corresponding color.

In Adobe Acrobat, a radio button group shares a single field name but contains multiple widgets (the individual buttons). Calling getField("RadioGroup").fillColor typically returns the appearance property of the first widget in the group array, rather than the currently active one.

1
Identify the selected value

Use event.target.value or this.getField('YourRadioGroup').value in your script to determine which radio button option the user currently selected.

2
Map values to colors

Create a JavaScript switch or if statement that maps each possible export value to its corresponding color array (e.g., color.red, color.blue, or ["RGB", 1, 0, 0]).

3
Apply or return the mapped color

Return the mapped color variable to your target script instead of trying to read the widget's native fillColor property directly.

Assign Color Based on the Selected Export Value
Widget References: Advanced users can also iterate through the field's widgets using the getWidget() method to check states and read individual widget appearances, though value mapping is generally more reliable.
Free Microsoft Office alternative

Edit PDF Forms Easily with WPS Office

Having trouble with complex form scripts in Adobe Acrobat? Try WPS Office. It provides a lightweight, free, and highly compatible suite for editing PDFs, Word, Excel, and PowerPoint files without the steep learning curve.

Easily view, fill, and manage interactive PDF forms without complex scriptingHighly compatible with Microsoft Office formats like DOCX, XLSX, and PPTXLightweight application that runs fast on any PC or mobile deviceFamiliar, easy-to-use interface requires no training to start working
microsoft office alternative - wps office

Frequently Asked Questions

Why does fillColor return the wrong color in a radio group?

A radio button group is treated as a single field with multiple widget children. The fillColor property reads from the root field or first child widget, disregarding the currently checked state of other widgets.

Can I use event.target.value to get the selected button's color directly?

No, event.target.value only returns the export value (typically a text string like 'Option1' or 'Yes') of the selected radio button, not its appearance properties.

How do I reference a specific radio button widget in Acrobat?

You can use the getWidget(index) method on the field object to reference a specific child widget by its index, allowing you to check its individual properties.