How to Format Number Combs with Hyphens in PDF Forms
Question details
The user needs to align characters with visual hyphens or dashes in PDF form fields, typically for entering formatted data like Social Security Numbers or credit cards.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Designing an interactive PDF form where text fields must align perfectly with pre-printed background hyphens.
- Observed behavior
- Standard character comb properties distribute characters evenly but do not align around background hyphens, causing visual overlap and formatting misalignment.
Make sure you have access to a PDF editor with advanced form field creation features, and verify exactly how many characters and hyphens your form layout requires.
Use a Single Text Field with Custom JavaScript
This is the most efficient method, utilizing a single text box that automatically formats the input with dashes as the user types.
Instead of relying on the standard comb feature, you can use a single field combined with custom formatting. This prevents alignment errors when placing text over background dashes.
Draw a single text field that covers the entire data entry area, including the space where the hyphens will appear.
Open the Field Properties, navigate to the Options tab, and ensure the 'Comb' setting is unchecked.
Go to the Format tab, choose 'Custom' as the format category, and enter a JavaScript snippet that automatically inserts a hyphen after every defined set of characters (e.g., every 4 digits).

Create Separate Text Fields for Each Segment
Manually create individual text fields for each segmented group of numbers if you prefer not to use JavaScript.
Design Interactive PDF Forms with WPS Office
WPS Office provides robust and intuitive PDF form editing tools. You can easily create, position, and customize text fields with precise formatting properties to build professional PDF documents.
- 1. Open your document: Launch WPS Office and open your PDF file using the built-in PDF editor.
- 2. Access form tools: Navigate to the Form tab on the top ribbon to view all interactive form controls.
- 3. Insert text fields: Select the Text Field tool and draw it exactly where you need user input on the document.
- 4. Customize properties: Right-click the new text field, choose Properties, and customize the layout, font size, and character limitations.

Frequently Asked Questions
Why does the standard comb setting fail to align with background hyphens?
The character comb property evenly distributes characters across the total width of the text field. It does not account for irregular spacing caused by background text, symbols, or hyphens, leading to visual overlap.
Can I set a maximum character limit when using custom formatting scripts?
Yes. You can still specify a maximum character limit in the field's options tab to ensure users don't exceed the required length, even when formatting scripts are actively adding hyphens.
How do I make the cursor automatically jump to the next box when using separate text fields?
To automatically shift focus to the next field when the character limit is reached, you need to add a custom keystroke JavaScript to the field properties that triggers the focus shift.




