Allow Users to Override an Auto-Populated PDF Form Field in Adobe Acrobat
Question details
Allow users to change a classroom value that is automatically populated from a teacher dropdown.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- A teacher dropdown supplies a default classroom, but a user may need to enter a different room.
- Observed behavior
- A calculation script populates the classroom field and may overwrite a user's manual entry.
Open the form in Adobe Acrobat and check the exact field names, dropdown export values, and existing calculation script. The instructions below use the field name Classroom and example teacher values, which you must replace with those in your form.
Populate an Empty Classroom Field with a Dropdown Validation Script
Use this approach to provide a default room without overwriting an existing manual entry.
The validation script fills the classroom only when it is empty. Selecting another teacher will not replace an existing room; clear the classroom field first if you want the next teacher selection to populate it.
Open the PDF in Acrobat, select Prepare a form, and open the classroom field's Properties. On the Calculate tab, disable or remove the calculation script that forces the classroom value. On the General tab, make sure Read Only is not selected.
Open the teacher dropdown's Properties, select the Validate tab, choose Run custom validation script, and select Edit. Enter a script such as: var room = this.getField("Classroom"); if (room && room.valueAsString === "") { if (event.value === "Teacher A") room.value = "Room 101"; else if (event.value === "Teacher B") room.value = "Room 102"; }
In the script editor, replace Classroom with the exact destination field name and replace the teacher and room examples with your dropdown values and classroom assignments. Add an else-if condition for each additional teacher, then close the field properties.
Save the PDF, exit form editing, and select a teacher from the dropdown. Type a different room in the classroom field, then interact with other fields to confirm that your entry remains unchanged.

Work with PDFs and Office Files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDF and Office files. Its format support makes it easy to move everyday documents into WPS, though Acrobat form scripts should be tested separately in the intended PDF viewer.

Frequently Asked Questions
Why does my classroom entry keep changing back?
A calculation script on the classroom field may run again and overwrite your entry. In Acrobat's Prepare a form tool, check the field's Properties > Calculate tab and remove the forced calculation if users need to edit the value.
Will changing the teacher replace a room entered by the user?
Not with the example script: it fills the classroom only when the field is empty. Clear the classroom field before selecting a teacher if you want the script to supply that teacher's default room.
What if the dropdown displays a name but the script does not fill the room?
Check the dropdown's Properties > Options for its export values. The script compares event.value with the selected value, so its teacher names must match the values used by the dropdown.
Will the form script work in every PDF viewer?
No. PDF viewers differ in their support for form JavaScript, and JavaScript may be disabled. Test the saved form in the viewer your users will use.




