How to Add Catalog Items to a PDF Order Form Using Buttons
Question details
The user wants to create a dynamic PDF order form where clicking 'Add' buttons beside catalog items populates an order list with item details like name, price, and product code.

- Product
- Device & OS
- not provided
- Scenario
- Creating an interactive digital product catalog or order form.
- Observed behavior
- Requires customers to click 'Add' buttons to build an order list at the end of the PDF, dynamically capturing details to summarize the order.
Before adding JavaScript to your PDF form, sketch out the form structure, decide how to handle duplicate items or quantities, and ensure you have designated text fields ready to receive the catalog item data.
Use Custom JavaScript to Create Dynamic 'Add' Buttons
Assign JavaScript actions to form buttons to capture item details and populate predefined order list fields.
Native PDF features do not include a built-in shopping cart function. To achieve this, you must rely on custom JavaScript that triggers when a user clicks the 'Add' button.
The script will need to retrieve the fixed data (product code, name, price) associated with that button and push it into the next available empty row in your order form fields.
Design the bottom of your PDF with empty text fields arranged in rows. Name them systematically, such as 'Row1_Name', 'Row1_Price', 'Row2_Name', etc.
Navigate to your form editing tools, select the Button tool, and draw a button next to your first catalog item.
Right-click the newly created button and select 'Properties'. Go to the 'Actions' tab.
Set the trigger to 'Mouse Up' and the action to 'Run a JavaScript'. Click 'Add'.
Enter a script that assigns the item's details to variables, checks which 'RowX' fields are currently empty, and populates the first available row with the item's data. Click 'OK' to save.

Design Interactive PDF Forms with WPS PDF
WPS PDF provides a user-friendly interface to create, edit, and manage interactive PDF forms. Easily add text fields, checkboxes, and buttons to streamline your data collection without needing complex setups for standard layouts.
- 1. Open your document: Launch WPS Office and open your PDF catalog or form document.
- 2. Access Form tools: Navigate to the 'Form' tab on the top ribbon to view all available interactive elements.
- 3. Add form fields: Select 'Text Field' or 'Push Button' to place interactive components next to your catalog items.
- 4. Edit properties: Double-click the added field to customize its name, appearance, and basic actions to suit your order form's layout.

Frequently Asked Questions
Do standard PDF forms support shopping cart functionality?
Native PDFs do not have built-in shopping carts. You must simulate this behavior using custom JavaScript attached to form buttons to move data into specific rows, calculate quantities, and compute totals.
Why isn't my PDF button updating the order list fields?
Ensure that your JavaScript accurately references the exact field names of your order list. Check for typos in the script and ensure the target text fields are set up to accept text inputs.
Can I calculate the total price automatically in a PDF form?
Yes. You can add a text field at the bottom of your order list, open its properties, go to the 'Calculate' tab, and set it to sum the values of the individual price fields in your order rows.
Will JavaScript in PDFs work on mobile devices?
Many mobile PDF readers have limited or no support for complex JavaScript. For mobile users, it is often better to use a simple fillable form or a web-based form rather than a highly scripted PDF.




