PDF Editing Issues

How to Populate a PDF Dollar Amount from a Drop-Down Selection

Algirdas JasaitisAlgirdas Jasaitis Nov 3, 2026 869 views

Question details

The user wants to automatically populate a marketing budget field based on a colleague selected from a drop-down list using PDF JavaScript, but needs to know the correct syntax for handling currency.

How to Populate a PDF Dollar Amount from a Drop-Down Selection
Product
PDF Editor
Device & OS
not provided
Scenario
Creating an interactive PDF form where selecting an option from a drop-down menu automatically fills another text field with a specific dollar amount.
Observed behavior
The JavaScript code fails to populate the field correctly when dollar signs or commas are included directly in the script's numeric values.
Before you start

Ensure your PDF editor supports form field creation and JavaScript execution, and verify that you have access to the form editing or 'Prepare Form' tools.

Solution 1Recommended

Use Raw Numeric Values and Apply Field Formatting

To prevent JavaScript errors, assign raw numeric values in your code and use the built-in field formatting options to display the currency symbols.

When writing JavaScript for PDF forms, including symbols like '$' or commas turns the numeric value into a text string. This can break calculations and auto-population scripts. The best practice is to pass a pure number in the code and let the PDF viewer handle the visual formatting.

1
Edit your JavaScript code

Open your drop-down list's action script and remove any dollar signs or commas from the assigned values. For example, change your code from event.value = "$1,000"; to event.value = 1000;.

2
Open target field properties

Right-click the text field where the marketing budget will be displayed (the target field) and select 'Properties' from the context menu.

3
Apply currency formatting

Navigate to the 'Format' tab in the Properties window. Select 'Number' from the format category drop-down, then choose the Dollar symbol and set the separator style to include commas.

Formatting Applied: The target field will now automatically display the raw number as a properly formatted currency value whenever a drop-down selection is made.
Edit PDF Forms with WPS Office

Manage PDF Forms Easily with WPS PDF

WPS PDF offers an intuitive interface for filling, creating, and managing interactive PDF forms. Whether you are handling budgets, invoices, or surveys, WPS Office makes document management seamless.

  1. 1. Open WPS Office: Launch WPS Office and open your PDF document using the built-in WPS PDF tool.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all available form fields and interactive elements.
  3. 3. Edit Field Properties: Double-click any form field to adjust its properties, appearance, and formatting options.
  4. 4. Save the Document: Once your form is configured, click 'Save' to preserve the interactive fields and formatting.
Easily fill and manage interactive PDF forms and drop-down lists.Highly compatible with standard PDF formats and Adobe Acrobat.Lightweight application that opens large PDFs quickly.Free to download with powerful built-in PDF reading and editing tools.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PDF JavaScript fail when I add a dollar sign?

PDF JavaScript treats values containing dollar signs and commas as text strings rather than numbers. For calculations or value assignments to work correctly, you must use raw numbers (like 1000) and apply currency formatting directly to the field's properties.

How do I format a PDF text field to show currency automatically?

Right-click the target text field, select Properties, and go to the Format tab. Choose the Number category, then select your desired currency symbol and decimal places.

Can I use JavaScript to calculate totals from multiple drop-down selections?

Yes, you can write a custom calculation script in the target field's properties. This script can retrieve the raw numeric values of multiple drop-down fields and add them together before displaying the formatted total.