PDF Editing Issues

Move PDF Form Fields Up When a Section Is Hidden in Adobe Acrobat

Anum MushtaqAnum Mushtaq Nov 24, 2026 868 views

Question details

Move a later section of a PDF form upward when conditional fields in the preceding section are hidden.

Move PDF Form Fields Up When a Section Is Hidden in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form displays additional fields when the user selects Yes and hides them when the user selects No.
Observed behavior
Selecting No hides the conditional fields but leaves a blank area before the next section.
Before you start

Open the form in Acrobat and identify the names of the conditional fields and every field that must move. Note their original positions and check whether section labels are form fields or fixed PDF content.

Solution 1Recommended

Use Acrobat JavaScript to reposition the following form fields

Use this approach when the form must change layout automatically after a Yes or No selection.

Hiding a field does not automatically reflow a PDF. Acrobat JavaScript can change a form field's rect property, using coordinates in the order [left, top, right, bottom]. Increasing both vertical coordinates moves a field upward without changing its height.

The example uses one conditional field and one following field. Repeat the visibility and position changes for all affected fields. Fixed page text and graphics cannot be moved with a form field's rect property; edit the page layout or use suitable form fields for content that must move.

1
Open the form editor

In Adobe Acrobat, open the PDF and choose All tools > Prepare a form. Check the field names in the form editor and replace the example names in the script with your own.

2
Add the No action

Open Properties for the No radio button, select Actions, choose Mouse Up and Run a JavaScript, then select Add. Enter: var show = false; var conditional = this.getField("ConditionalField"); var following = this.getField("NextField"); conditional.display = show ? display.visible : display.hidden; following.rect = show ? [72, 400, 250, 380] : [72, 480, 250, 460];

3
Add the Yes action

In Properties > Actions for the Yes radio button, add the same Mouse Up JavaScript but change the first statement to var show = true. This shows the conditional field and returns the following field to its original position.

4
Set and test positions

Replace both example coordinate arrays with positions appropriate for your form, preserving each field's width and height. Save the PDF, exit form editing, and select Yes and No to check the layout in an Acrobat viewer with JavaScript enabled.

Use Acrobat JavaScript to reposition the following form fields
Viewer support varies: PDF viewers do not all support Acrobat JavaScript or form-field repositioning. Test the saved form in the viewers your recipients will use.
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 documents. It can help with general PDF editing, but it does not fix or guarantee support for Acrobat JavaScript that dynamically moves form fields.

Access PDF tools alongside document, spreadsheet, and presentation editorsOpen and edit Microsoft Office formats, including DOCX, XLSX, and PPTXUse a familiar interface to transition from Microsoft OfficeWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does a blank space remain after I hide a PDF form field?

A PDF form does not automatically reflow when a field is hidden. Use Acrobat JavaScript to update the rect coordinates of the fields below it, or redesign the page layout.

How do I move a form field upward without resizing it?

In the field's rect array, increase both the top and bottom coordinates by the same amount while leaving the left and right coordinates unchanged.

Can the script move a section heading as well?

It can reposition the heading if the heading is a form field. Fixed PDF page text is not a form field, so it must be edited in the page layout or replaced with suitable movable content.

Will the form work in every PDF viewer?

Not necessarily. Some viewers limit or do not support Acrobat JavaScript and field repositioning. Test the Yes and No actions in the PDF viewers your recipients use.