How to Create Tiered If-Else Calculations in PDF Acrobat Forms
Question details
The user needs to configure a PDF form to calculate a dynamic total or sponsorship amount using varying per-unit rates depending on the quantity entered in a specific form field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Setting up an interactive PDF form that automatically processes tiered pricing, discounts, or sponsorship levels based on user input.
- Observed behavior
- The form requires a custom calculation logic to apply conditional if-else rules, calculating and displaying the correct total automatically.
Ensure your PDF application supports interactive form fields and JavaScript calculations. Take note of the exact name of the input field (e.g., 'Text4') in your form, as you will need to reference it in your code.
Add a Custom JavaScript Calculation
You can implement tiered pricing or calculations by applying a custom JavaScript script with if-else conditions to the properties of your target total field.
Acrobat forms fully support JavaScript for advanced form fields. By writing a simple conditional script, you can specify different multiplier rates based on the numerical ranges of a source field.
Open your PDF file and enter 'Prepare Form' or 'Form Edit' mode in your PDF application.
Right-click the text field where you want the calculated amount to appear, then select 'Properties' from the context menu.
In the Properties dialog box, click on the 'Calculate' tab.
Select the 'Custom calculation script' radio button, then click the 'Edit' button.
Input your conditional logic. For example: var amount = Number(this.getField('Text4').valueAsString); if (amount < 1000) event.value = amount * 25; else if (amount < 2000) event.value = amount * 24; else event.value = amount * 23; Replace 'Text4' with the actual name of your quantity field.
Click 'OK', close the Properties dialog box, and exit form editing mode. Enter a quantity into the source field to verify the calculation is working.

Create and Manage Interactive PDF Forms with WPS Office
WPS Office includes a feature-rich PDF editor that makes it incredibly easy to design, fill out, and manage interactive PDF forms. You can add text fields, configure standard calculations, and customize form layouts without needing expensive standalone PDF software.
- 1. Open Your PDF: Launch WPS Office and open your PDF document.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon menu to access the interactive field tools.
- 3. Insert Form Fields: Click on 'Text Field' or other controls to drag and drop them anywhere in your document.
- 4. Configure Properties: Double-click the inserted field to open its properties, format the appearance, and set calculation preferences.

Frequently Asked Questions
Can I add more than three pricing tiers to my PDF form?
Yes. You can expand your JavaScript by chaining additional 'else if' statements to cover as many quantity ranges and pricing tiers as your form requires.
Why is my PDF calculation not updating automatically?
Check your application's settings to ensure 'Automatically calculate field values' is enabled. Additionally, if multiple calculated fields are used, ensure the field calculation order is correct so dependent fields update in the proper sequence.
Do custom PDF form scripts work on mobile devices?
While simple calculations often work on mobile viewers, complex custom JavaScript calculations are primarily supported by desktop applications like Adobe Acrobat or WPS PDF. Mobile support can vary depending on the PDF reader app.




