PDF Editing Issues

How to Use Acrobat JavaScript to Multiply a PDF Form Field by a Fixed Number

Kushani NimanthikaKushani Nimanthika Oct 28, 2026 869 views

Question details

The user needs to set up a calculation within a PDF form that takes a number entered in one field, multiplies it by a fixed constant (like 50), and automatically displays the result in a second field.

How to Multiply a Form Field by a Fixed Number Using Acrobat JavaScript
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating an interactive PDF form that requires automated mathematical calculations to determine prices, quantities, or scores.
Observed behavior
The target field requires a custom JavaScript calculation to correctly evaluate the user input and display the multiplied output.
Before you start

Ensure you know the exact name of the input field you plan to reference, as JavaScript in PDF forms is entirely case-sensitive.

Solution 1Recommended

Apply a Custom Calculation Script to the Result Field

Use Acrobat's built-in JavaScript engine to perform the multiplication automatically whenever the user updates the specific input field.

PDF forms support custom JavaScript code to handle complex calculations. By writing a simple script in the calculation properties of your result field, you can extract the value from your source field, convert it to a number, and multiply it by your fixed value.

1
Open Form Editing Mode

Open your PDF document in Adobe Acrobat. Go to the 'Tools' menu and select 'Prepare Form' to make your fields editable.

2
Access Field Properties

Right-click on the result field (where you want the multiplied number to appear) and select 'Properties' from the context menu.

3
Set Up Custom Calculation

Navigate to the 'Calculate' tab in the Properties window. Select the option that says 'Custom calculation script', and then click the 'Edit' button.

4
Enter the JavaScript Code

In the JavaScript editor, type: event.value = Number(this.getField("BackpackCount").value) * 50; (replace 'BackpackCount' with the exact name of your input field and '50' with your desired multiplier). Click 'OK'.

5
Test the Calculation

Close the Properties window, exit the 'Prepare Form' mode, and type a number into your input field to verify that the result field updates automatically.

Apply a Custom Calculation Script to the Result Field
Field Formatting: For best results, go to the 'Format' tab of both your input and result fields and ensure they are formatted as a 'Number'. This prevents text from interfering with the math operation.
Powerful PDF Form Management

Fill and Manage Interactive PDFs Seamlessly with WPS Office

While Acrobat handles deep JavaScript customization, WPS Office provides an incredibly user-friendly and lightweight PDF solution. WPS PDF allows you to instantly open, fill, and save interactive PDF forms with automated calculations intact, making it ideal for standard daily operations.

  1. 1. Launch WPS PDF: Open WPS Office and navigate to the PDF module from the main dashboard.
  2. 2. Open Your Form: Click 'Open' and select your interactive PDF form that contains the automated fields.
  3. 3. Fill the Data: Click directly on the highlighted form fields to input your numbers. Any built-in form calculations will automatically process as you type.
  4. 4. Save and Export: Once your form is filled out, click the save icon or export the document safely without losing your entered data.
Easily view, fill, and sign interactive PDF forms without lag.Fully compatible with standard Adobe PDF formats and existing form scripts.Lightweight alternative to heavy and expensive PDF editors.Seamlessly convert PDF files to Word, Excel, and PowerPoint.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my PDF custom calculation not working?

This usually happens if the field names in your JavaScript don't exactly match the actual form field names (remember it's case-sensitive) or if there are syntax errors like missing parentheses in your code.

Can I multiply two different fields together instead of using a fixed number?

Yes. You can either use the built-in 'Value is the product of the following fields' option in the Calculate tab, or use a script like: event.value = Number(this.getField('Field1').value) * Number(this.getField('Field2').value);

Does the custom calculation script work on mobile PDF viewers?

Calculations powered by complex JavaScript might not trigger correctly on all third-party or mobile PDF viewers. For guaranteed functionality, it is recommended to fill out dynamic forms using standard PDF software on a desktop.