Other PDF Issues

Combine Checkbox and Dropdown Values in an Acrobat Form Reference Number

Elise WilliamsElise Williams Nov 19, 2026 869 views

Question details

Create a reference number in an Acrobat form using selected checkbox values, a dropdown value, and a random numeric suffix.

Combine Checkbox and Dropdown Values in an Acrobat Form Reference Number
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A form needs to calculate a reference number from the user's selections.
Observed behavior
The existing JavaScript does not calculate the reference number because of syntax and field-value errors.
Before you start

Open the PDF in Acrobat and choose All tools > Prepare a form. Check the exact names and export values of the checkboxes and dropdown, and make sure the output is a text field.

Solution 1Recommended

Add a custom calculation script to the reference number field

Use this approach to assemble selected export values and a random suffix in an Acrobat form field.

The example uses two separate checkbox fields named Check Box1 and Check Box2, a dropdown named Data_Type, and a text field for the result. Change the names in the script if your form uses different names.

The dropdown placeholder must have the export value Select. The script ignores that value and checkbox values of Off.

1
Configure the form fields

In Prepare a form, open each checkbox's Properties and set an export value other than Off on the Options tab. In the Data_Type dropdown's Properties > Options, set the placeholder's export value to Select and configure the other options.

2
Open the calculation editor

Open the reference number text field's Properties, select the Calculate tab, choose Custom calculation script, and click Edit.

3
Enter the script

Paste this script into the JavaScript editor, then click OK: var parts = []; var c1 = String(this.getField("Check Box1").value); var c2 = String(this.getField("Check Box2").value); var dtype = String(this.getField("Data_Type").value); if (c1 !== "Off") parts.push(c1); if (c2 !== "Off") parts.push(c2); if (dtype !== "Select") parts.push(dtype); if (parts.length === 0) { event.value = ""; } else { var suffix = ("0000000000" + Math.floor(Math.random() * 10000000000)).slice(-10); event.value = parts.join("-") + "-" + suffix; }

4
Test the calculation

Close the field properties, preview the form, and select different checkboxes and dropdown options. Confirm that the output contains the selected export values and a 10-digit suffix, and is blank when no selections are made.

Add a custom calculation script to the reference number field
The suffix can change: Acrobat can run calculation scripts again when form values change, so the random suffix may change on recalculation. Random numbers can also repeat; this script does not guarantee a permanent or unique reference number.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office files. Its format compatibility makes moving existing documents easier, but it does not fix Acrobat calculation scripts or guarantee that scripted PDF forms will behave the same way.

Open and review PDFs alongside other documents.Compatible with Microsoft Office formats, including DOCX, XLSX, and PPTX.Use a familiar interface to move between documents, spreadsheets, and presentations.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the script check for Off?

An unchecked Acrobat checkbox normally returns Off. Checking that value prevents an unselected checkbox from being added to the reference number.

Where do I find a checkbox's export value?

In Acrobat, open All tools > Prepare a form, open the checkbox's Properties, and look on the Options tab. Use an export value other than Off for the selected state.

Why does the reference number change after I edit the form?

The random suffix is generated each time the calculation script runs. Acrobat may recalculate the field after other form values change, so this method is not suitable for a permanent identifier without additional logic.

What if my dropdown placeholder does not use Select?

Open the dropdown's Properties > Options and check the placeholder's export value. Either change it to Select or replace Select in the script with the actual export value.