PDF Editing Issues

How to Display a Dash for Empty or Zero Currency Fields in PDF

Phi Hung VoPhi Hung Vo Nov 10, 2026 868 views

Question details

The user needs to format a PDF currency field so that any empty or zero values display as a dash with a euro symbol (e.g., "- €"), rather than a numeric zero.

How to Display a Dash for Empty or Zero Currency Fields in a PDF
Product
Adobe Acrobat / PDF Forms
Device & OS
not provided
Scenario
Customizing interactive PDF forms to apply specific European formatting rules for currency fields.
Observed behavior
By default, the PDF field displays an empty or zero value as a numeric value (like "0.00 €"), and the user wants to override this specific state with text ("- €").
Before you start

Ensure you have access to a PDF editor with form editing and JavaScript capabilities, and verify that your target form fields are set up as interactive text fields.

Solution 1Recommended

Apply a Custom Format Script to the Field

Use a custom JavaScript formatting rule to evaluate the input. If it is zero or empty, it will display the dash; otherwise, it will apply standard currency formatting.

Using a custom format script is the best approach because it changes how the data looks on the screen without altering the underlying numeric value, meaning it won't break other calculation fields that depend on this data.

1
Open Field Properties

Right-click the target currency text field in your PDF form editing mode and select 'Properties'.

2
Select Custom Format

Navigate to the 'Format' tab. In the 'Select format category' dropdown menu, choose 'Custom'.

3
Enter the JavaScript Code

Click the 'Edit' button next to 'Custom Format Script' and enter the following code: if (event.value === "" || event.value === 0) { event.value = "- €"; } else { event.value = util.printf("€ %,2.2f", event.value); }

4
Save and Test

Click 'OK' to save the script, then close the Properties dialog. Switch back to normal viewing mode to test the field by entering a zero.

Apply a Custom Format Script to the Field
Customizing the Output: You can easily adjust the script if you need the Euro symbol to appear after the dash by changing the string to "€ -" or modifying the util.printf statement for non-zero numbers.
Advanced PDF Form Management

Manage and Fill PDF Forms Easily with WPS Office

WPS Office provides a highly capable PDF Editor that allows you to easily view, fill, and manage interactive PDF forms while offering robust compatibility with industry-standard formats.

  1. 1. Open Your PDF: Launch WPS Office and open your interactive PDF form document.
  2. 2. Access Form Tools: Navigate to the 'Form' or 'Edit' tab to interact with the document's fields and structure.
  3. 3. Fill and Save: Enter your data into the form fields. WPS Office will perfectly render custom formatting scripts, allowing you to save the completed document securely.
Seamlessly open, fill, and save interactive PDF forms with 100% format compatibility.Easily edit PDF text, images, and pages without converting to other formats.Lightweight, all-in-one office suite containing Word, Excel, PowerPoint, and PDF editing tools.
QA img-9

Frequently Asked Questions

Why doesn't the standard currency format show a dash by default?

Standard PDF currency formatting strictly formats numeric values and defaults to displaying a numeric zero (e.g., 0.00). To override this default behavior and display text characters like a dash, a custom JavaScript rule is required.

Will using a validation script affect my PDF calculations?

Yes. If you use a validation script to change a numeric 0 into a text string like "- €", any subsequent formula fields that rely on this field for mathematical calculations may return an error. It is generally safer to use a format script, which alters the display but keeps the underlying value as 0.

Can I format the field to show the currency symbol after the number?

Yes. If your region places the Euro symbol after the number, you can modify the custom format script to: event.value = util.printf("%,2.2f €", event.value); and set the zero output to "- €" or "€ -" as needed.