How to Create a PDF Order Form That Exports Only Selected Items
Question details
The user wants to build a dynamic PDF order form that allows customers to select product quantities and then exclusively exports the items that have a quantity greater than zero.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Designing a large, interactive PDF order form where clients select specific items from an extensive inventory list.
- Observed behavior
- A need to filter out products with zero quantity so the final exported order list or generated PDF is concise and only displays the selected items.
Before starting, ensure you have access to a PDF editor that supports document-level JavaScript execution and page templates, as native PDF functionality requires scripting to hide or spawn dynamic elements.
Use Acrobat JavaScript with SpawnTemplate
Utilize the built-in SpawnTemplate feature to dynamically add order rows or pages only when a user needs them.
The SpawnTemplate feature is designed specifically for creating dynamic PDF elements. By keeping a hidden template page, you can write a script that generates a new visible row or page only when triggered.
This approach keeps the initial PDF file concise and expands it dynamically as the user adds more items to their order.
Create your default visible order page and design a separate, hidden template page containing the row layout for a single product.
Navigate to the form preparation tools in your PDF editor. Locate the page templates settings, name your hidden page, and configure it as a hidden template.
Insert a button on the main page. Assign a JavaScript action using the getTemplate("YourTemplateName").spawn() method to duplicate the template when the user clicks to add an item.
Add a corresponding delete button on the spawned template that allows the user to remove the row or page if they input a zero quantity.

Export a Filtered Plain-Text Order List
Write a simpler document script that loops through all quantity fields and exports a plain-text summary of only the items with a quantity greater than zero.
Easily Create Interactive PDF Forms with WPS Office
While complex dynamic spawning requires advanced JavaScript, you can easily design, manage, and edit interactive fillable PDF order forms using WPS PDF. It offers an intuitive interface to add text fields, checkboxes, and buttons without needing extensive coding knowledge.
- 1. Open WPS PDF: Launch WPS Office and open your base order form document in the WPS PDF editor.
- 2. Access the Form Tools: Click on the 'Form' tab located in the top navigation ribbon to access all interactive form creation tools.
- 3. Add Form Controls: Select elements like 'Text Field', 'Check Box', or 'Drop-Down List', and click on the document area where users will input their quantities.
- 4. Edit Field Properties: Double-click the inserted form fields to adjust their properties, including field names, default values, and text formatting.
- 5. Save and Distribute: Once your static or interactive elements are complete, click 'Save' to finalize the PDF form for distribution.

Frequently Asked Questions
Can I make a PDF form dynamic without using JavaScript?
No, native PDF formats are inherently static. To conditionally hide, show, or spawn new pages and rows based on user input, document-level JavaScript is strictly required.
Why are empty fields still showing up when I export PDF form data?
Standard PDF form submission processes export all designated form fields regardless of their values. You must implement a custom script to filter out fields with a zero or empty value before exporting.
What is the SpawnTemplate method in PDFs?
SpawnTemplate is a JavaScript method used in PDFs that takes a hidden template page within the document and creates a new, visible copy at runtime. It is ideal for adding repeating rows to invoices or order forms.
Can I fill out interactive PDF forms on a mobile device?
Yes, most modern PDF readers, including the WPS Office mobile app, fully support filling out standard text fields and checkboxes. However, highly complex JavaScript functions like SpawnTemplate may not execute properly on all mobile PDF viewers.




