These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Auto-Advancing Form Fields in Adobe Acrobat 9 Standard

EmKelly2
Registered: Feb 15 2011
Posts: 2
Answered

I have form fields in an interactive pdf. I need one box for each letter/number of the name, address, phone, etc. Once a letter is keyed in, I want to automatically advance to the next field. I want the user to type seemlessly, advancing through the boxes w.o needing to hit tab or enter. I used a custom keystroke script which does half the job. The script was:
 
if ( event.fieldFull || event.willCommit ) this.getField("er2").setFocus();
 
It brings the focus to the next field, but the character isn't effortlessly entered into the next field - you must hit enter (or tab) to make the next field accept the entry. So here's an example: the form has 8 boxes and the user wants to enter F A I R P O R T. I want them to continuously type "fairport" and have one letter end up in each box without entering tab or using enter. Please help! I'm not an "advanced" user...Thank you!

Em Kelly

My Product Information:
Acrobat Standard 9.2, Windows
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Accepted Answer
Hi EmKelly,

You might want to consider using a Comb field. With a comb field the user is automatically forwarded to the next field after each key stroke. From Acrobat's Help-

"Comb Of Characters Spreads the user-entered text evenly across the width of the text field. If a border color is specified on the Appearance tab, each character entered in the field is separated by lines of that color. This option is available only when no other check box is selected."

Hope this helps,

Dimitri
www.pdfscripting.com
www.windjack.com








gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
If you need to do this on a form with individual fields:

Here is the document level JavaScript for auto tabbing:

function goNext(oItem, oEvent, cName) {
/* Tab to next field when field character limit is reached.
Includes error trapping and displays on JavaScript console
the error, field where error occurred and next field name.

parameters:
oItem - required - item where fields to process reside
oEvent - required - field being processed
cName - required - next field's name

Place call to this function in the fields custom format.
The user responsible for checking format of field.
Default number check is for the standard numeric values.
"0-9" for single character fields and includes sign values for multi character fields.

Call as a custom keystroke:
goNext(this, event,"NextField");

*/
try{ // error catcher
AFNumber_Keystroke(0, 0, 0, 0, "",true);
if (oEvent.rc && AFMergeChange(oEvent).length == oEvent.target.charLimit) oItem.getField(cName).setFocus();
} catch(eMsg) { // trap error display error message, field in and next field
app.beep(3); // beep
console.println("Error: " + eMsg + "\nField: " + oEvent.target.name + "\nNext Field: " + cName);
} finally { // always run
return; }

} //end // goNext


// custom keystroke code
goNext(this, event, "NextFieldName");

This script has been around since version 4.

George Kaiser

EmKelly2
Registered: Feb 15 2011
Posts: 2
Thank you both so much for the VERY helpful information. Lucky for me the "comb" option works perfectly! Easy to use and easy to understand. Thanks. Case closed!

Em Kelly

JLGA
Registered: Sep 22 2011
Posts: 1
I know this is an old topic, but I am having trouble getting fields to automatically advance. I have single numeric field (phone nummbers, account numbers) that I have set up using the Comb field command of 1 character. But after saving and testing, the fields still do not automatically advance.

I have even copied and pasted gkaiseril's code in the document Javascripts with no luck.

What am I missing?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
For a field of one character the comb property does not make much sense. If you can I would use a comb field with a length of the required number of characters and separator characters.

If you are going to use the provided scripts, you will have to edit the cName parameter to match your field names.

George Kaiser