PDF Editing Issues

How to Move an Acrobat Form Field Based on Another Field's Selection

John WilsonJohn Wilson Oct 28, 2026 868 views

Question details

The user wants to know how to dynamically change the position of one PDF form field when a specific value is selected in a different form field.

How to Move a PDF Form Field Based on Another Field's Selection
Product
PDF
Device & OS
not provided
Scenario
Creating an interactive PDF form where the layout or field placement needs to adapt automatically based on user choices.
Observed behavior
The user requires a programmatic method to manipulate the field coordinates based on the selection made in another controlling field.
Before you start

Ensure you have access to advanced PDF form editing tools that support JavaScript actions, and note the initial coordinates of the field you wish to move.

Solution 1Recommended

Use JavaScript to Modify the Target Field's Rect Property

You can dynamically reposition fields by writing a custom action or validation script on the controlling field using the rect property.

In interactive PDF forms, every form field has a 'rect' property that represents its physical boundaries on the page. This property is defined by an array of four coordinate points: the upper-left and lower-right corners.

By assigning a JavaScript action to the controlling field (such as a dropdown or radio button), you can test the selected value and assign a completely new set of coordinates to the target field, effectively moving it.

1
Open the controlling field's properties

Enter form editing mode, right-click the controlling field (e.g., your dropdown menu), and select 'Properties'.

2
Navigate to the JavaScript action

Go to the 'Actions' or 'Format/Validate' tab, select 'Run a JavaScript' as the action type, and click 'Add'.

3
Write the conditional logic

Write a JavaScript conditional statement to check the user's selection, for example: if (event.value == 'Choice1') { ... }

4
Reassign the rect property

Inside your condition, update the target field's coordinates using the syntax: this.getField('TargetField').rect = [left, top, right, bottom];

Use JavaScript to Modify the Target Field's Rect Property
Understanding Rect Coordinates: The 'rect' array must strictly follow the format [left, top, right, bottom]. To find the exact numbers you need, you can temporarily place the field where you want it and query its rect property via the JavaScript console.
Powerful PDF Form Editor

Easily Manage and Edit PDF Forms with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to create, edit, and interact with PDF forms effortlessly. Whether you are adding text fields, setting up checkboxes, or adjusting form layouts, WPS PDF makes document manipulation simple and intuitive.

  1. 1. Open your PDF document: Launch WPS Office and open the PDF file you wish to edit.
  2. 2. Access form tools: Navigate to the 'Form' tab located in the top ribbon menu to access interactive field options.
  3. 3. Adjust field placement: Click on any existing form field to manually drag, drop, and resize its boundaries without needing complex code.
  4. 4. Save the interactive PDF: Once your layout is adjusted, save the document to preserve the form's interactive properties.
Intuitive drag-and-drop PDF form creation toolsFully compatible with standard PDF formats and interactive fieldsLightweight, fast, and seamless to use across different devices
microsoft office alternative - wps office

Frequently Asked Questions

What exactly does the rect property array represent in a PDF form?

The rect property array contains four numerical values structured as [left, top, right, bottom]. These points define the precise coordinates of the upper-left and lower-right corners of the field's bounding box on the PDF page.

Can I hide a PDF form field instead of moving it?

Yes. If your goal is to make a field disappear based on a selection, you can manipulate its display property instead of its rect property by using: this.getField('TargetField').display = display.hidden;

Where can I find the exact coordinates to use in my rect array?

You can find a field's exact coordinates by placing it in the desired location, opening the JavaScript debugging console in your PDF editor, and running: console.println(this.getField('TargetField').rect); to output the coordinate values.