How to Spawn PDF Template Pages with Unique Form Field Names
Question details
The user needs to generate multiple copies of a PDF template page with uniquely named form fields so that data entered on one page does not automatically duplicate on others.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Duplicating PDF template pages containing fillable form fields.
- Observed behavior
- When standard template pages are spawned, the new form fields share the original names, causing entered data to synchronize across all spawned pages.
Ensure that your PDF form has a designated template page created and that you have basic familiarity with running JavaScript within your PDF editor.
Use JavaScript to Spawn Pages with Independent Form Fields
Execute a specific JavaScript command that duplicates the template and automatically renames the spawned fields, keeping their values independent.
In PDF forms, fields with identical names automatically share the same values. To avoid this when duplicating a page, you must instruct the PDF viewer to assign unique names to the newly created fields.
Open your PDF editor and locate the exact name of the hidden template page you intend to duplicate.
Navigate to your PDF editor's JavaScript console, or assign a document-level script to a specific trigger button.
Enter the following script: getTemplate("TemplateName").spawn(this.numPages, true, false); Ensure you replace 'TemplateName' with the actual name of your template.
Fill out a form field on the newly spawned page. Verify that the original template page or other spawned pages do not automatically populate with the same data.

Easily Manage PDF Pages and Forms with WPS Office
If you prefer avoiding complex JavaScript coding, WPS Office provides an intuitive, user-friendly interface to manage PDF pages and form fields directly.
- 1. Open your PDF document: Launch WPS Office and open the PDF form you need to modify.
- 2. Duplicate the required pages: Navigate to the 'Page' tab to visually extract, insert, or duplicate the necessary pages without using scripts.
- 3. Modify form field properties: Access the 'Form' tab to select individual fields and manually rename them to ensure their values remain independent.
- 4. Save your changes: Click 'Save' to apply the new unique field names to your document.

Frequently Asked Questions
Why do my PDF form fields automatically copy data to other pages?
This happens because the duplicated form fields share the exact same internal name. In PDF forms, fields with identical names are linked, so entering data in one automatically updates all others.
Can I rename PDF form fields manually instead of using JavaScript?
Yes. In capable PDF editors like WPS Office, you can right-click the form field, access its Properties, and manually change the 'Name' attribute to make it unique.
What does the 'true' parameter do in the PDF spawn script?
In the script getTemplate().spawn(this.numPages, true, false), the 'true' parameter instructs the program to automatically append unique identifiers to the fields on the new page, ensuring they operate independently from the original template.




