PDF Editing Issues

How to Calculate PDF Form Prices from Drop-Down Menu Values

Chanuka GeekiyanageChanuka Geekiyanage Nov 5, 2026 869 views

Question details

The user needs to configure a PDF order form to dynamically adjust the item price based on the size selected from a drop-down menu.

How to Calculate PDF Form Prices from Drop-Down Menu Values
Product
PDF Editor
Device & OS
not provided
Scenario
Creating a merchandise order form where standard sizes (XS-XL) cost a base price, and larger sizes (2XL-3XL) cost an upgraded price, requiring dynamic multiplication.
Observed behavior
The current calculation settings cannot assign different unit prices conditionally based on the chosen size from the drop-down menu.
Before you start

Ensure your PDF editing software supports advanced form editing and custom JavaScript calculations. Verify that your size drop-down menu has clearly defined export values before setting up the script.

Solution 1Recommended

Use a Custom Calculation Script in the Total Field

By applying conditional JavaScript to your total field, the form can read the size selection and automatically apply the correct price multiplier.

Standard field math operations cannot handle conditional logic. To assign varied pricing based on text selections, you must utilize a custom calculation script within the final total field's properties.

1
Verify Drop-Down Export Values

Open the form editing mode and access the properties of your 'Size' drop-down menu. In the 'Options' tab, confirm that the export values accurately represent the sizes (e.g., '2XL') so they can be accurately referenced by the calculation code.

2
Open Total Field Properties

Right-click the 'Total' text box where the final calculated price should appear, and select 'Properties' from the context menu.

3
Access the Calculate Tab

In the Text Field Properties dialog, click on the 'Calculate' tab to change how the field determines its value.

4
Enter the Custom Script

Choose the 'Custom calculation script' option and click 'Edit'. Enter a JavaScript code that sets the price variable based on the size field (e.g., if size equals '2XL' or '3XL', price = 28; else price = 25) and multiplies that price by the value of the 'Quantity' field.

Use a Custom Calculation Script in the Total Field
Script Syntax: Ensure that the field names used in your JavaScript exactly match the actual names of the fields in your PDF form, as JavaScript is highly case-sensitive.
Simplify PDF Editing

Manage and Fill PDF Forms with WPS Office

WPS Office provides a comprehensive, lightweight PDF solution that allows you to easily read, fill, and manage interactive PDF forms without the bloat of expensive alternatives.

  1. 1. Open Your PDF Form: Launch WPS Office and open your interactive PDF merchandise order form.
  2. 2. Interact with Fields: Navigate the document to seamlessly select items from drop-down menus and input text into specified fields.
  3. 3. Save and Export: Once your selections are made and the calculations are complete, save the file securely or export it directly to share with your clients.
Easily interact with drop-down menus and fillable form fields.Highly compatible with standard Adobe PDF document formats.Lightweight installation with an intuitive, user-friendly interface.Seamlessly convert between PDF, Word, Excel, and PowerPoint.
QA img-9

Frequently Asked Questions

Why is my PDF custom calculation script failing to update the price?

The most common reason for a failing script is a mismatch between the field names in your code and the actual field properties. Double-check that capitalization and spelling match perfectly, and ensure your drop-down options have correct export values set.

Can I use Simplified Field Notation instead of JavaScript for conditional pricing?

No. Simplified Field Notation is only suitable for basic arithmetic like addition or multiplication across fields. Conditional logic, such as assigning a $28 price specifically when '2XL' is chosen, strictly requires a custom JavaScript calculation.

How do I check the export values of a PDF drop-down list?

Enter form editing mode, right-click the drop-down field, and select 'Properties'. Navigate to the 'Options' tab, where you will see the visible 'Item' name alongside its underlying 'Export Value'.