How to Create a Custom PDF Field Mask Like MAT-9999-DWOR
Question details
The user needs to create a specific PDF form field mask (MAT-9999-DWOR) where static text is preserved upon export, but the built-in Arbitrary Mask tool misinterprets the letter 'O' as an input placeholder.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating a custom ID field in a PDF form that requires specific static prefixes and suffixes to be exported alongside the user's numerical input.
- Observed behavior
- The Arbitrary Mask field treats the letter 'O' in '-DWOR' as an input character instead of static text, breaking the intended format and preventing accurate data entry.
Determine exactly how the form data will be extracted (e.g., exported as CSV, submitted via a server script, or manually downloaded), as this affects which custom scripting or formatting workaround will work best for your workflow.
Use Custom JavaScript for Form Field Formatting
Since the built-in Arbitrary Mask feature uses 'O' as a reserved placeholder, applying a custom JavaScript format script is the best way to enforce static prefixes and suffixes.
Standard PDF arbitrary masks use specific letters (like 'O', 'A', 'X') to dictate input types. To bypass this limitation and force static text like 'MAT-' and '-DWOR', you must apply a custom format script to the field's properties.
Open your PDF form in editing mode, right-click the target text field, and select 'Properties' from the context menu.
Navigate to the 'Format' tab and choose 'Custom' from the Select Format Category dropdown list.
In the Custom Format Script box, enter a script to append the prefix and suffix to the user's input. For example: `if (event.value) { event.value = 'MAT-' + event.value + '-DWOR'; }`.
In the Custom Keystroke Script box, enter a script to restrict the user's input to only 4 numbers, ensuring the core data matches the '9999' requirement.
Close the properties dialog, switch to the hand tool or preview mode, and test the field by entering a 4-digit number.

Use Separate PDF Form Fields for Prefix, Input, and Suffix
If you want to avoid JavaScript entirely, you can split the ID into three distinct fields on your PDF document and merge them later upon export.
Create and Manage PDF Forms with WPS Office
WPS Office provides robust PDF editing capabilities, allowing you to easily insert text fields, customize formats, and manage form data without complex setups.
- 1. Open Your PDF: Launch WPS Office and open your PDF document.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access interactive form field tools.
- 3. Insert Text Fields: Click 'Text Field' and drag on your document to place the field exactly where you need it.
- 4. Customize Properties: Double-click the newly created field to configure its properties, set default values, and apply formatting restrictions.

Frequently Asked Questions
Why does the Arbitrary Mask treat the letter 'O' as an input character?
In standard PDF form specifications, certain characters like 'O', 'A', and 'X' are strictly reserved as formatting masks to dictate alphanumeric input. This prevents them from being interpreted as plain static text within the mask settings.
Can I force an Arbitrary Mask to ignore the letter 'O'?
No, the built-in arbitrary mask rules are hardcoded into the standard PDF format. Escaping the character (e.g., using a backslash) is typically not supported by standard PDF viewers, which is why Custom JavaScript is recommended for complex static strings containing reserved letters.
Will the custom formatted field be preserved when I export the form data?
Yes, if configured correctly using the JavaScript method, the final field value becomes the complete string. When you export to CSV or submit the form data, it will contain the full 'MAT-9999-DWOR' format.




