How to Format PDF Form Numbers with a Measurement Suffix
Question details
The user needs to format a numeric PDF form field to display two decimal places followed by a measurement suffix (such as 99.00mm) while ensuring the field prompts a numeric keypad on an iPad.

- Product
- Device & OS
- iPad
- Scenario
- Creating a fillable PDF form where users input a number of varying digit lengths, and the form automatically appends a unit of measurement without breaking underlying numeric validations.
- Observed behavior
- Using arbitrary input masks fails because the inputted values have varying lengths. Adding the suffix as text directly into the field prevents accurate numeric validation and calculation.
Verify that your PDF editing software allows you to access and modify field properties, specifically the ability to add custom JavaScript format and validation scripts to text fields.
Use a Custom Format Script for the Suffix
Apply a custom JavaScript format script to change how the number is displayed by appending the suffix, while keeping the underlying value strictly numeric for calculations and mobile keypad compatibility.
By separating the display format from the actual inputted value, the PDF continues to treat the input as a number. This allows mathematical calculations to function correctly and ensures the numeric keypad appears on mobile devices like the iPad.
Open your PDF form editor, switch to the Form editing mode, right-click the specific numeric text field, and select Properties.
In the Properties dialog box, click on the 'Format' tab to adjust how the data is displayed.
Select 'Custom' from the Select Format Category dropdown list. In the Custom Format Script box, enter a script such as: if (event.value !== '') { event.value = util.printf('%.2f', event.value) + 'mm'; }
Ensure the underlying value remains a number by navigating to the 'Validate' tab (or using the Keystroke script) and restricting inputs to numbers only. Save the PDF.

Utilize Built-in Currency Formatting as a Suffix
If you do not want to use JavaScript, some PDF editors allow you to hijack the built-in Currency format by replacing the currency symbol with your measurement unit and placing it after the number.
Easily Create and Edit PDF Forms with WPS Office
WPS Office offers comprehensive PDF form creation and editing tools. You can easily manage text fields, apply precise numeric formatting, and ensure your forms function seamlessly across different devices.
- 1. Open Your PDF Form: Launch WPS Office and open your PDF document containing the interactive forms.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access all interactive field tools.
- 3. Edit Field Properties: Double-click or right-click any text field to open its properties, where you can modify formats, validations, and appearance settings.

Frequently Asked Questions
Why does adding a measurement unit directly to my PDF field break my calculations?
When text characters like 'mm' are concatenated directly into the field's actual value, the PDF reader treats the entire entry as a text string rather than a number. This breaks any mathematical calculations linked to that field. You must use a display format script so the true underlying value remains strictly numeric.
Will custom JavaScript formatting work on my iPad?
JavaScript support depends entirely on the PDF viewer app used on the iPad. The official Adobe Acrobat mobile app supports most form scripts, but the default built-in iOS viewers (like Preview or Files) often have limited or no JavaScript support. It is highly recommended to test your form on the specific app your audience will use.
How do I force the numeric keypad to appear on mobile PDF forms?
To trigger the numeric keypad on a mobile device, the PDF field's format category must be explicitly set to 'Number', or the field's underlying validation must restrict input to numbers only. If the field allows arbitrary text, the standard alphanumeric keyboard will display.




