PDF Editing Issues

How to Reset Selected PDF Form Fields Without Clearing Others

Steven ParkerSteven Parker Nov 5, 2026 869 views

Question details

The user needs a method to clear specific interactive fields in a PDF form while keeping other fields, such as sequential invoice numbers, intact.

How to Reset Selected PDF Form Fields Without Clearing Others
Product
PDF
Device & OS
not provided
Scenario
Creating or managing an interactive PDF form where users need to clear their inputted data via a reset button without erasing auto-generated or fixed fields.
Observed behavior
The standard resetForm() script clears the entire form, erasing data in fields that must remain unchanged.
Before you start

Ensure you are in the PDF Form editing mode and write down the exact case-sensitive field names for the fields you want to clear and the ones you want to preserve.

Solution 1Recommended

Use an Explicit Field List in the resetForm() Script

Modify the JavaScript attached to your reset button to target only specific fields by passing an array of field names, preventing it from clearing the whole document.

By default, the resetForm() command without any parameters clears all fields in the active document. By passing a specific array of field names into the function's brackets, you instruct the PDF reader to only clear those designated fields.

1
Open Form Editing Mode

Open your PDF document in your preferred PDF editor and access the Form editing mode to interact with the fields.

2
Identify Target Fields

Check the properties of the fields you want to reset and note down their exact names (e.g., 'Field1', 'Field2').

3
Edit the Reset Button Action

Right-click your Reset button, open its Properties, and navigate to the Actions tab. Set the action to 'Run a JavaScript' and click Edit or Add.

4
Update the JavaScript

Replace the generic this.resetForm(); script with your specific array. Type: this.resetForm(["Field1", "Field2"]); replacing the example names with your actual field names. Leave out the names of fields like your invoice IDs.

Use an Explicit Field List in the resetForm() Script
Syntax check: Ensure that the field names inside the quotation marks match your form fields exactly, as JavaScript is fully case-sensitive.
Edit PDF Forms Easily

Create and Manage Interactive PDF Forms with WPS Office

WPS Office offers a powerful PDF editing suite that allows you to create interactive forms, add buttons, and manage form field actions seamlessly through an intuitive interface, often eliminating the need for complex JavaScript.

  1. 1. Open your PDF in WPS Office: Launch WPS Office and open the PDF form you wish to modify.
  2. 2. Access the Form Tools: Navigate to the 'Form' tab on the top ribbon to reveal the interactive form field features.
  3. 3. Configure Button Properties Visually: Add a push button and double-click it to open properties. Under Actions, choose 'Reset a form'. WPS Office allows you to visually select which fields to include or exclude from the reset action.
Easily add, edit, and configure interactive PDF form fieldsFully compatible with standard PDF formats and Adobe Acrobat formsConfigure button actions visually without needing to write code manuallyLightweight application that works smoothly on multiple devices
microsoft office alternative - wps office

Frequently Asked Questions

Why does my reset button clear the entire PDF form?

By default, adding a standard reset action or an empty this.resetForm() JavaScript command instructs the PDF software to clear all user-input fields in the active document. To change this, you must specify the exact fields to reset.

Can I reset fields by specifying which ones NOT to reset instead?

The standard resetForm() array specifically looks for fields TO reset. If you want an exclusion method, you would need to write a slightly more advanced loop script that iterates through all document fields and resets them only if their name does not match your excluded fields (like your invoice numbers).

How do I find the exact names of my PDF form fields?

In your PDF editor's form mode, double-click any text field or right-click and select 'Properties'. Under the General tab, you will find a 'Name' attribute. This is the exact identifier you need to use in your JavaScript array.