PDF Editing Issues

How to Add Number Formatting and Units to PDF Form Fields in Acrobat

Rana GarciaRana Garcia Nov 3, 2026 869 views

Question details

The user needs to format a numeric value entered into a PDF form field to include standard number separators, decimal places, and a specific text unit suffix (e.g., displaying "8000" as "8,000.00 feet").

How to Add Number Formatting and Units to Acrobat PDF Form Fields
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating or editing an interactive PDF form that requires physical measurements, dimensions, or custom currency displays.
Observed behavior
Standard PDF number formatting lacks built-in options for custom text suffixes, requiring a custom JavaScript solution to format the display while maintaining the numeric value for calculations.
Before you start

Ensure you have the necessary permissions to edit the PDF form and that your target form field is set as a 'Text' field before applying custom JavaScript formatting.

Solution 1Recommended

Use a Custom Format Script with util.printf

Apply a JavaScript custom format script to automatically add commas, decimal places, and the required unit suffix to the entered number.

This is the most reliable method for appending text units to a number in a PDF form. It formats the visual display of the field while keeping the underlying value strictly numeric, ensuring that any subsequent calculations relying on this field continue to work correctly.

1
Enter Prepare Form Mode

Open your PDF document in Adobe Acrobat, navigate to the 'Tools' menu, and select 'Prepare Form'.

2
Access Field Properties

Right-click the target text field where users will enter the number and select 'Properties' from the context menu.

3
Select Custom Format

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

4
Add the Formatting Script

In the 'Custom Format Script' box, click the 'Edit' button and paste the following code: `if ((event.value == "") || (event.value == 0)) event.value = ""; else event.value = util.printf("%,0.2f feet", event.value);`

5
Save and Test

Click 'OK' and then 'Close'. Exit the Prepare Form mode and test the field by typing a number like 8000 to verify it automatically formats to '8,000.00 feet'.

Use a Custom Format Script with util.printf
Customize the Unit: You can replace the word 'feet' in the code snippet with any other unit you require, such as 'meters', 'kg', or 'sq ft'.

Create and Manage PDF Forms Seamlessly with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to effortlessly create, edit, and fill interactive PDF forms. Whether you need to manage text fields, adjust data formatting, or fill out complex forms, WPS PDF offers a highly compatible and intuitive experience without the steep learning curve.

  1. 1. Launch WPS PDF: Open WPS Office and click on the 'PDF' tab to launch the built-in PDF editor.
  2. 2. Open Your Form: Click 'Open' to load your existing interactive PDF form or use a blank document to start creating a new one.
  3. 3. Edit Form Fields: Navigate to the 'Form' tab on the top ribbon to insert new text fields, checkboxes, or dropdown menus.
  4. 4. Adjust Properties: Double-click any text field to access its properties, where you can modify appearance, alignment, and default text formatting.
  5. 5. Save and Export: Once your form is filled or configured, click 'Save' to ensure all data and formatting remain fully intact for sharing.
Fully compatible with standard PDF forms and Acrobat-created documents.Easily insert text fields, checkboxes, and interactive form elements.Lightweight application that runs smoothly across Windows, Mac, and mobile.Rich PDF editing toolkit with a familiar, user-friendly interface.
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't standard Acrobat number formatting enough for adding units?

Standard PDF number formatting typically only supports predefined currency symbols or percentage signs. It does not provide built-in options to append custom text strings like 'feet' or 'kg' to the end of a numeric value, which makes Custom Format Scripts necessary.

Will adding a text unit via JavaScript break my form calculations?

No, as long as you use a Custom Format Script. This type of script only alters the visual display (the formatted output) while keeping the underlying exported or calculated value strictly numeric. Using standard string concatenation without proper formatting events might break calculations.

How do I change the number of decimal places in the custom format script?

In the `util.printf` function, adjust the `%,0.2f` parameter. Change the `2` to `0` for no decimal places (e.g., `%,0.0f`), or to `3` for three decimal places (e.g., `%,0.3f`).

What happens if a user types text instead of a number into the field?

If the field is not restricted, the custom format script might return an unexpected result or 'NaN' (Not a Number). You can prevent this by navigating to the field's 'Format' tab and ensuring it expects a numeric input, or by utilizing a keystroke validation script to reject alphabetical characters.