Create a Self-Grading PDF Test in Adobe Acrobat
Question details
Create a language test in a PDF form that automatically scores selected and typed answers.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- The user wants to build a language test with dropdowns, radio buttons, checkboxes, and text fields.
- Observed behavior
- The completed form should calculate a total score from the user's answers.
Open the test PDF in Adobe Acrobat and identify the correct answer and point value for each question. Plan unique field names and decide which typed answers should be accepted.
Build and Score the Test with Acrobat Form Fields
Use answer export values and a custom calculation script to total scores, including a typed response.
The example awards one point for each correct answer. It uses Q1 for a radio-button group, Q2 for a dropdown, Q3 for a single checkbox, Q4 for a text answer, and TotalScore for the calculated score.
PDF JavaScript support varies by viewer. Test the form in the PDF reader your respondents will use; the script and answer key are not secure against inspection.
Open the PDF in Adobe Acrobat, select Prepare a Form, and add a radio-button group named Q1, a dropdown named Q2, a checkbox named Q3, and a text field named Q4. Add another text field named TotalScore.
Open each choice field's Properties. For Q1, give the correct radio button a choice value of 1 and incorrect buttons a value of 0. On Q2's Options tab, set each item's export value to 1 or 0, including a placeholder with an export value of 0. In Q3's Options, set the checkbox export value to 1; leave it unchecked by default.
Open TotalScore Properties, select Calculate, choose Custom calculation script, and click Edit. Paste the following script: var fields = ['Q1', 'Q2', 'Q3']; var total = 0; for (var i = 0; i < fields.length; i++) { var value = this.getField(fields[i]).valueAsString; if (value === '1') total += 1; } var answer = this.getField('Q4').valueAsString; answer = answer.replace(/^\s+|\s+$/g, '').toLowerCase(); if (answer === 'bonjour') total += 1; event.value = total;
Replace 'bonjour' in the script with the correct Q4 answer. Use Preview in Prepare a Form to try correct, incorrect, blank, and unchecked answers, then save the PDF and test it in the intended reader.

Prepare Test Documents with WPS Office
WPS Office is a free, lightweight alternative for preparing test content in a familiar interface. Its Microsoft Office format compatibility helps you move existing documents into WPS; use Acrobat to build and test the JavaScript-based PDF scoring form.

Frequently Asked Questions
How do radio buttons contribute to the score?
In Prepare a Form, open each radio button's Properties and set its choice value to represent the score. The calculation script reads the selected value from the radio-button group.
Why does an unchecked checkbox not add a point?
An unchecked Acrobat checkbox normally returns Off rather than its export value. The example script adds a point only when Q3 returns 1.
Can the text answer ignore capitalization and extra spaces?
Yes. The sample calculation removes spaces at the beginning and end of Q4 and converts the answer to lowercase before comparing it with 'bonjour'.
Will the form calculate in every PDF viewer?
No. Some PDF viewers restrict or do not support Acrobat JavaScript. Save the form and test it in the reader your respondents will use.
Can respondents see the correct answers in the PDF?
Potentially. A PDF calculation script can contain the answer key, so this approach is not suitable for a test that requires a secure answer key.




