How to Reset Selected PDF Form Fields Without Clearing Others
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.

- Product
- 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.
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.
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.
Open your PDF document in your preferred PDF editor and access the Form editing mode to interact with the fields.
Check the properties of the fields you want to reset and note down their exact names (e.g., 'Field1', 'Field2').
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.
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.

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. Open your PDF in WPS Office: Launch WPS Office and open the PDF form you wish to modify.
- 2. Access the Form Tools: Navigate to the 'Form' tab on the top ribbon to reveal the interactive form field features.
- 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.

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.




