PDF Editing Issues

Set a PDF Field to 50 or 0 Based on a Selection in Adobe Acrobat

Emma BrownEmma Brown Nov 18, 2026 869 views

Question details

Configure a PDF form field to display 50 for YES and 0 for NO or N/A.

Set a PDF Field to 50 or 0 Based on a Selection in Adobe Acrobat
Product
Adobe Acrobat Pro
Device & OS
not provided
Scenario
A form asks the user to choose one of three responses and calculates a corresponding value.
Observed behavior
The value field should show 50 for YES, 0 for NO or N/A, and a defined result when no option is selected.
Before you start

Open the PDF in Adobe Acrobat Pro and check whether the existing choices are separate check boxes or a single-choice group. Decide what the value field should show when no option is selected; the example below leaves it blank.

Solution 1Recommended

Use a radio button group and a calculated text field

Use this method when only one response should be allowed and the value should update automatically.

Radio buttons are better suited than independent check boxes for mutually exclusive answers. The script below returns 50 for YES, 0 for NO or N/A, and a blank value when nothing is selected.

1
Open form editing

In Acrobat Pro, open the PDF and choose All tools > Prepare a form. If the existing check boxes are independent, replace them with three radio buttons.

2
Configure the choices

Give all three radio buttons the same group name, Response. In each button's Properties > Options, set its radio button choice to YES, NO, or NA, respectively. Label the choices YES, NO, and N/A on the form.

3
Add the result field

In Prepare a form, add a text field where the calculated value should appear. Open its Properties and select Read Only on the General tab if users should not override the result.

4
Enter the calculation

In the text field's Properties, open Calculate, select Custom calculation script, and click Edit. Enter: var r = this.getField('Response').valueAsString; event.value = (r === 'YES') ? 50 : ((r === 'NO' || r === 'NA') ? 0 : '');

5
Save and test

Save the PDF, exit form editing, and select each response. Confirm that YES displays 50, NO and N/A display 0, and an unselected group leaves the result blank.

Use a radio button group and a calculated text field
Check PDF viewer support: The calculation relies on Acrobat JavaScript. Test the saved form in the PDF viewers your recipients will use, because not all viewers support form scripts.
Free Microsoft Office alternative

Work with PDF and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface and compatibility with common Office formats for an easy transition. It can help you work with PDFs and spreadsheets, but it does not replace Acrobat's form-scripting workflow described above.

Open and work with PDF documents alongside Office filesCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXFamiliar interface for moving between documents and spreadsheetsFree and lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why use radio buttons instead of check boxes?

Radio buttons with the same group name allow one response at a time. Independent check boxes can allow conflicting selections unless additional logic prevents them.

How can I display 0 when no option is selected?

In the calculated field's Properties > Calculate > Custom calculation script, replace the final empty string in the example script with 0. The field will then show 0 for an unselected group as well as for NO and N/A.

Can users change the calculated value themselves?

Open the result field's Properties > General. Select Read Only to prevent manual changes, or leave it unchecked if users should be able to edit the field.

Why does the calculation work in Acrobat but not in another PDF viewer?

Some PDF viewers do not support Acrobat JavaScript or may have scripting disabled. Open the form in Acrobat or Acrobat Reader and check its JavaScript settings, then test it in the viewer intended for recipients.