Populate an Adobe Acrobat Form Field from a Yes or No Selection
Question details
Automatically populate a Final Score field based on a Yes or No selection in an Acrobat form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A form contains an Overall Score, a Yes or No answer, and a Final Score field.
- Observed behavior
- The desired Final Score is 1 when Yes is selected and the Overall Score when No is selected.
Open the PDF in Adobe Acrobat and select All tools > Prepare a form. Confirm that the form has an Overall Score field, a Yes or No radio-button group or drop-down, and a Final Score text field.
Add a custom calculation to the Final Score field
Use an Acrobat JavaScript calculation to return 1 for Yes and copy Overall Score for No.
In Prepare a form, open the properties of the Yes and No radio buttons or the drop-down field. On the Options tab, set the corresponding export values to yes and no. For radio buttons, use the same field name for both choices and a different choice value for each.
Double-click the Final Score text field, select the Calculate tab, choose Custom calculation script, and click Edit.
Paste this script into the editor and replace the field names with the exact names used in your form: var score = this.getField("Overall Score").value; var answer = this.getField("Answer Question").valueAsString; if (answer == "yes") { event.value = 1; } else if (answer == "no") { event.value = score; } else { event.value = ""; }
If Overall Score is itself calculated, use More > Set Field Calculation Order in Prepare a form and place Overall Score before Final Score.
Save the PDF, enter a numeric Overall Score, and select Yes and then No. Verify that Final Score shows 1 for Yes and the Overall Score for No; with no answer selected, it should be blank.

Work with office documents and PDFs in WPS Office
WPS Office is a free, lightweight alternative for working with office documents and PDFs. Its familiar interface and Microsoft Office format compatibility make it easy to move existing files into WPS. Use Adobe Acrobat for the custom form calculation described above; WPS is not a replacement for that Acrobat scripting workflow.

Frequently Asked Questions
Why doesn't the Final Score change when I select Yes or No?
In Prepare a form, check that the answer field name matches the script and that its Options tab uses the export values yes and no. Also test the PDF in a viewer that supports Acrobat form JavaScript.
Can I use a drop-down instead of radio buttons?
Yes. In the drop-down field's Options tab, assign yes and no as the export values for the two items. The same calculation script can read the drop-down field.
What happens if no answer is selected?
The script sets Final Score to a blank value when the answer is neither yes nor no.
Why is Final Score showing an old Overall Score?
If Overall Score is calculated, open Prepare a form > More > Set Field Calculation Order and move Overall Score before Final Score. Then test the selections again.




