PDF Editing Issues

Limit PDF Text Field Length and Move to the Next Field in Acrobat

Kushani NimanthikaKushani Nimanthika Nov 18, 2026 868 views

Question details

Set a limit on a PDF form text field and automatically move the user to the next field when the limit is reached.

Limit PDF Text Field Length and Move to the Next Field in Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating a PDF form with consecutive text fields that should advance automatically after a specified amount of input.
Observed behavior
The desired form limits input in one field and moves focus to the next field; a word limit requires additional logic.
Before you start

Open the PDF in an Acrobat version that supports form editing and identify the current and next text field names in Prepare a Form. Decide whether a character limit will meet your needs, since it is different from a word limit.

Solution 1Recommended

Set a character limit and add a keystroke script in Acrobat

Use the built-in character limit and a custom script to advance to another field when the limit is reached.

This method limits characters, not words. A true word limit needs separate logic to define and count words across spaces and punctuation.

1
Open the field properties

In Acrobat, open Prepare a Form, then double-click the text field you want to limit. On the General tab, note its name and identify the name of the next field.

2
Set the character limit

In the field properties, open Options, select Limit of characters, and enter the desired number, such as 10.

3
Add the advance script

Open the Format tab, select Custom, and click Edit next to Custom Keystroke Script. For a 10-character limit, enter the following script, replacing NextField with the exact name of the next field: if (!event.willCommit && event.change) { var value = event.value.substring(0, event.selStart) + event.change + event.value.substring(event.selEnd); if (value.length >= 10) { var next = this.getField("NextField"); if (next) next.setFocus(); } }

4
Save and test the form

Close the properties dialog, save the PDF, and use Preview in Prepare a Form to type into the field. Check that the final character is retained and focus moves to the intended field. Also test replacement selections and pasted text.

Set a character limit and add a keystroke script in Acrobat
Check viewer support: Automatic focus depends on Acrobat JavaScript support and settings. Other PDF viewers, including browser and mobile viewers, may handle the script differently or not run it.
Free Microsoft Office alternative

Edit PDFs and Office files with WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDF and Office files. It supports common Microsoft Office formats for easier migration, but it should not be assumed to reproduce Acrobat's custom JavaScript field behavior.

Open and work with PDF documents alongside Office filesCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXFamiliar interface for users moving from Microsoft OfficeFree, lightweight option for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Does a character limit also limit the number of words?

No. The Limit of characters setting on the text field's Options tab counts characters rather than words. A word limit requires additional JavaScript logic for spaces and punctuation.

Where do I find the next field's name?

In Prepare a Form, double-click the target field and check its Name on the General tab. Use that exact name in the getField call in the current field's script.

Why doesn't the focus move when the field is full?

Check that the script's number matches the character limit, the target field name is correct, and JavaScript is enabled in the PDF viewer. Test the saved form in Acrobat because other viewers may not support the script.

What happens if someone pastes more characters than the limit?

Paste handling can vary by viewer and field settings. Test an oversized paste in Acrobat's form preview and confirm both the retained text and the focus behavior before distributing the form.