PDF Editing Issues

How to Create PDF Comb Fields with Spacing and Automatic Tab Order

Jason MillerJason Miller Nov 2, 2026 869 views

Question details

The user needs to group number entries in a PDF form with visible spacing between sets and automatically move the typing focus to the next field when the current comb field is filled.

How to Create Comb Fields with Spacing and Automatic Tab Order in PDFs
Product
PDF
Device & OS
not provided
Scenario
Creating advanced interactive PDF forms for structured data inputs like phone numbers, Social Security numbers, or credit card details.
Observed behavior
The goal state is to have visually separated blocks of comb fields where reaching the maximum character count of one block automatically triggers a jump to the subsequent field.
Before you start

Ensure you are using a comprehensive PDF editor that supports both interactive form field properties and custom keystroke JavaScript execution.

Solution 1Recommended

Use Separate Comb Fields with Auto-Tab JavaScript

Using separate text fields allows for precise visual spacing between number groups, while a custom script handles the automatic transition to the next field.

Since native PDF formatting doesn't automatically jump to the next object out-of-the-box, the most reliable method is dividing your input into separate comb fields and applying a short JavaScript snippet to detect the character limit.

1
Insert separated text fields

Draw individual text fields for each specific group of numbers, leaving physical space between them on your document layout.

2
Configure comb properties

Right-click each text field, select 'Properties', navigate to the 'Options' tab, check the 'Comb of characters' box, and enter the exact character limit for that specific block.

3
Add custom keystroke script

Go to the 'Format' or 'Actions' tab within the field properties and select 'Custom Keystroke Script'.

4
Insert focus-shifting code

Input a script that detects the length and shifts focus, for example: `if (event.value.length == 4) getField('NextField_Name').setFocus();`, adjusting the number '4' and 'NextField_Name' to match your form.

Use Separate Comb Fields with Auto-Tab JavaScript
Exact Field Names: Ensure that the field name referenced in your JavaScript exactly matches the target text field's name, as JavaScript in PDFs is case-sensitive.
Advanced PDF Form Tools

Easily Build Interactive PDF Forms with WPS Office

WPS Office offers robust PDF editing capabilities, enabling you to effortlessly insert text fields, manage comb formatting, and configure interactive form properties to streamline data entry.

  1. 1. Open your PDF document: Launch WPS Office and open the PDF file you wish to turn into an interactive form.
  2. 2. Access form tools: Navigate to the 'Form' tab on the top ribbon to view all interactive elements.
  3. 3. Insert text fields: Click 'Text Field' and draw the input areas directly onto your document where the number entries should go.
  4. 4. Adjust field properties: Right-click the newly created fields and select 'Properties' to modify character limits and formatting.
Easily draw and align interactive text fields, checkboxes, and buttons.Seamlessly compatible with Adobe Acrobat PDF formats and form structures.Lightweight software with an intuitive interface for quick form creation.
microsoft office alternative - wps office

Frequently Asked Questions

What is a comb field in a PDF?

A comb field is a specific text field property in PDFs that evenly spaces the user's input across the width of the field. It separates each typed character into its own visible cell or block, which is highly useful for forms requiring precise character placement like ID numbers.

Why isn't my auto-tab JavaScript working in the PDF?

Auto-tab functions can fail if the PDF viewer has JavaScript disabled for security reasons, or if there is a typo in the target field name within the script. Additionally, some basic PDF readers on mobile devices do not support complex JavaScript executions.

Is it possible to auto-tab without using JavaScript?

No, the standard PDF form specification does not natively include an 'auto-tab to next field' setting. Implementing this behavior strictly requires adding a custom keystroke or formatting JavaScript to the field.

How do I align multiple separated comb fields perfectly?

Most advanced PDF editors offer alignment tools. You can select all your separated text fields by holding down the Ctrl or Shift key, right-click, and use the 'Align' (e.g., Align Bottom) and 'Distribute Horizontally' options to ensure even spacing.