Show Acrobat PDF Form Fields After an Item Number Is Entered
Question details
Show the unit-of-measure and calculated total fields in a purchase order PDF only after an item number is entered.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A purchase order form has an item number, unit of measure, and calculated total for each row.
- Observed behavior
- The unit-of-measure and total fields should be hidden when the item number is empty and visible when it has a value.
Open the PDF in Adobe Acrobat and identify the exact field names for each item number, unit of measure, and total. Confirm that the item number is a text field and that Acrobat JavaScript is enabled for testing.
Use an Acrobat validation script to control field visibility
Apply a custom validation script to each item number field so its related fields appear when a value is entered.
In Acrobat, open the purchase order PDF and select Prepare a form. Check the field names in the form editor.
For a blank form, open Properties for each unit-of-measure and total field. On the General tab, set Form Field to Hidden so the fields start out hidden.
Open Properties for the first item number field, such as N1. On the Validate tab, select Run custom validation script, click Edit, and enter: this.getField("U1").display = event.value == "" ? display.hidden : display.visible; this.getField("T1").display = event.value == "" ? display.hidden : display.visible;
Replace U1 and T1 with the exact unit-of-measure and total field names for that row. Open each remaining item number field's Validate tab and add the corresponding script with its own field names.
Save the PDF, exit form editing, and enter an item number. Commit the entry by moving focus to another field; the related fields should appear. Clear the item number and move focus again to confirm they are hidden.

Work with purchase order documents in WPS Office
WPS Office is a free, lightweight alternative for working with office documents and PDFs in a familiar interface. Its Microsoft Office format support helps you move existing files across; use Acrobat to configure and test the JavaScript visibility behavior described above.

Frequently Asked Questions
Where do I add the visibility script in Acrobat?
Select Prepare a form, open the item number field's Properties, and use Validate > Run custom validation script > Edit. Add the script to the item number field, not the fields being shown or hidden.
How do I keep the unit and total fields hidden when the form opens?
For a blank form, open each dependent field's Properties in Prepare a form and set Form Field to Hidden on the General tab. Test the initial state separately if the PDF already has item numbers.
Why do the fields appear only after I leave the item number field?
The validation script runs when the entry is committed. After typing the item number, press Tab or click another field to trigger validation.
Will the script work in every PDF viewer?
No. The viewer must support Acrobat form JavaScript and allow it to run. Test the saved PDF in the viewer your form users will use.




