How to Automatically Hide Empty Rows in an Acrobat PDF Form
Question details
The user wants to configure an interactive PDF form so that repeating rows left blank by the respondent are automatically hidden in the final document.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating a dynamic, résumé-style PDF form with repeating rows for accomplishments and employers, where unused sections collapse cleanly instead of showing empty gaps.
- Observed behavior
- By default, form fields and static text rows remain visible and take up document space even if the user leaves the text fields completely blank.
Ensure you are using a premium PDF editor that supports JavaScript execution and form field property editing, as basic PDF viewers cannot configure advanced display scripts.
Use JavaScript to Control Field Visibility Properties
Apply a custom JavaScript snippet to a trigger event (like a Calculate event or a custom button) to test if fields are empty and update their display status.
Because PDF documents do not automatically reflow or collapse empty space like word processors do, you must utilize JavaScript to make the document dynamic.
By setting up a script, you can evaluate the value of each field within a row. If the field's value is blank, the script will change the field's visibility property from visible to hidden. Note that any static text labels must also be converted to read-only fields if you want them to disappear alongside the input fields.
Launch your PDF editor (such as Adobe Acrobat Pro) and open your document. Navigate to the 'Prepare Form' or 'Form' editing tool.
Decide what will trigger the check. You can right-click a 'Submit' or 'Validate' button, or open Document Properties to use a Calculate event, then select 'Properties'.
Go to the 'Actions' tab. Choose 'Run a JavaScript' from the Select Action dropdown menu and click 'Add'.
In the editor, write an if-statement to check the field values. For example: if (this.getField("Row1Field").valueAsString == "") { this.getField("Row1Field").display = display.hidden; } else { this.getField("Row1Field").display = display.visible; }
Click 'OK' to save the script. Exit form editing mode and test your document in a standard PDF reader by leaving the fields blank and triggering the script.

Create and Manage Interactive PDF Forms with WPS Office
WPS Office provides a comprehensive PDF editing suite that allows you to effortlessly fill, create, and manage interactive form fields. With an intuitive interface, it makes handling complex PDF documents highly efficient.
- 1. Open Your PDF: Launch WPS Office and open your target PDF document.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to reveal all interactive field tools.
- 3. Insert Form Fields: Select the Text Field, Checkbox, or Push Button tools to design your custom layout directly on the page.
- 4. Edit Field Properties: Double-click any inserted field to modify its appearance, name, and interactive properties, then save the document.

Frequently Asked Questions
Why aren't my hidden PDF form fields reappearing when I clear the form?
If your JavaScript only sets the display property to 'display.hidden' when empty but lacks an 'else' condition to set it back to 'display.visible' when data is entered or the form is reset, the fields will remain permanently hidden. Ensure your script includes both conditions.
Can I hide standard document text along with the form fields?
Standard PDF files do not natively reflow static text. To hide text (such as an 'Employer Name' label) along with the empty field, you must convert that static text into a read-only form field and include it in your visibility JavaScript.
Will these JavaScript form actions work on mobile PDF readers?
Most basic or mobile PDF viewers do not support JavaScript execution. For dynamic form features like auto-hiding rows to work properly, users should fill out the form using robust desktop applications.
How do I trigger the hiding script automatically without a submit button?
You can attach the JavaScript to a document-level 'Calculate' event. This allows the script to evaluate the fields automatically as the user types and tabs through the form, creating a real-time dynamic response.




