How to Create a PDF Form Field with a Custom Mask and Uppercase Letters
Question details
The user needs to create a PDF form field that enforces a specific alphanumeric mask pattern (e.g., A999A) while automatically converting inputted alphabetic characters into uppercase.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Designing a fillable PDF form that requires strict data entry formatting to ensure consistency and correctness of the collected information.
- Observed behavior
- The built-in Arbitrary Mask option restricts input characters but cannot simultaneously alter the casing of the text to uppercase automatically.
Ensure you are using a PDF editor that supports JavaScript validation, such as Adobe Acrobat Pro or WPS Office PDF, and have your document open in form editing mode.
Use a Custom JavaScript Validation Script
Since standard mask options cannot modify text casing, you can use a custom keystroke or validation script to automatically convert lowercase letters to uppercase while enforcing your desired format.
Applying a custom JavaScript allows you to bypass the limitations of standard formatting masks. You can separate the uppercase conversion logic from the pattern validation to achieve the exact behavior you need.
Enter 'Prepare Form' mode in your PDF editor. Right-click on the specific text field you want to modify and select 'Properties' from the context menu.
Click on the 'Calculate' or 'Validate' tab located at the top of the Text Field Properties dialog box.
Select the option for 'Custom calculation script' or 'Run custom validation script'. Click the 'Edit' button and enter the following JavaScript code: event.value = event.value.toUpperCase();
If using a calculation script for the uppercase conversion, you can switch to the 'Format' tab, select 'Special', and enter your 'Arbitrary Mask' (e.g., A999A) to strictly enforce the alphanumeric pattern.
Click 'Close' to save your field properties. Exit form editing mode or select the 'Preview' tool, then type into the text field to verify the letters convert to uppercase and the pattern is enforced.

Use a Standard Arbitrary Mask with Instructions
If you prefer not to use JavaScript, you can strictly enforce the format mask and add visual cues requesting users to utilize uppercase letters.
Easily Create and Edit Fillable PDF Forms with WPS Office
WPS Office features a robust built-in PDF editor that enables you to design, edit, and manage interactive fillable forms. With advanced tools to customize text fields, checkboxes, and properties, it ensures your data collection is precise and professional.
- 1. Open Your PDF: Download and launch WPS Office, then open the PDF document you want to turn into a fillable form.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon menu to reveal all interactive field options.
- 3. Insert a Text Field: Click on 'Text Field' and drag your cursor over the document to draw the input area for your users.
- 4. Customize Field Properties: Double-click the newly created text field to open its properties, where you can set character limits, default text, and visual styling.

Frequently Asked Questions
Why isn't the arbitrary mask converting my text to uppercase?
The arbitrary mask feature is designed exclusively to restrict the type of characters allowed (such as letters versus numbers) to match a pattern. It lacks the functional capability to dynamically alter or capitalize the text input. To achieve capitalization automatically, a custom JavaScript must be applied.
Can I apply custom JavaScript validation in all PDF readers?
While custom JavaScript validation executes perfectly in standard, full-featured PDF editors like Adobe Acrobat and WPS Office, some basic web browsers or default mobile PDF viewers might block or fail to support script execution. It's recommended to advise users to fill out forms in dedicated PDF software.
How do I test the custom script in my PDF form?
After adding the script in the text field properties, you must exit 'Prepare Form' or editing mode. Switch to the Hand tool or 'Preview' mode, then type lowercase letters into the field and click outside of it. The text should immediately convert to uppercase if the script is correct.




