How to Use Acrobat JavaScript to Multiply a PDF Form Field by a Fixed Number
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.

- 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.
Ensure you know the exact name of the input field you plan to reference, as JavaScript in PDF forms is entirely case-sensitive.
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.
Open your PDF document in Adobe Acrobat. Go to the 'Tools' menu and select 'Prepare Form' to make your fields editable.
Right-click on the result field (where you want the multiplied number to appear) and select 'Properties' from the context menu.
Navigate to the 'Calculate' tab in the Properties window. Select the option that says 'Custom calculation script', and then click the 'Edit' button.
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'.
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.

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. Launch WPS PDF: Open WPS Office and navigate to the PDF module from the main dashboard.
- 2. Open Your Form: Click 'Open' and select your interactive PDF form that contains the automated fields.
- 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. Save and Export: Once your form is filled out, click the save icon or export the document safely without losing your entered data.

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.




