How to Display a Dash for Empty or Zero Currency Fields in PDF
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.

- 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 ("- €").
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.
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.
Right-click the target currency text field in your PDF form editing mode and select 'Properties'.
Navigate to the 'Format' tab. In the 'Select format category' dropdown menu, choose 'Custom'.
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); }
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.

Use a Custom Validation Script
Alternatively, you can keep your default format settings and apply a validation script that strictly replaces a "0" input with your desired text.
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. Open Your PDF: Launch WPS Office and open your interactive PDF form document.
- 2. Access Form Tools: Navigate to the 'Form' or 'Edit' tab to interact with the document's fields and structure.
- 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.

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.




