• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Auto-tab in PDF form without a character limit

Community Beginner ,
Apr 26, 2018 Apr 26, 2018

Copy link to clipboard

Copied

I created a PDF form to be used with a scanner input that I want to auto-tab to the next field without having to set a character limit (i.e., I want it to behave like Excel).  I already have a Java script to perform the auto-tab function, but it requires a character limit.  Is there a way to auto-tab without a character limit?

TOPICS
PDF forms

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 27, 2018 Apr 27, 2018

The first multiline script is intended to be placed in a document-level JavaScript. You have to do it this way due to a quirk in Acrobat that occurs when you use one of the built-in functions (AFMergeChange).

The second one-line script is what you place in the Keystroke script of the field.

If you don't know how to create a document-level JavaScript, post again, and include the version of Acrobat that you're using.

Votes

Translate

Translate
Community Expert ,
Apr 26, 2018 Apr 26, 2018

Copy link to clipboard

Copied

What should trigger it, then?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 26, 2018 Apr 26, 2018

Copy link to clipboard

Copied

I'm not sure because I don't know how Excel works in the background.  How does it know to auto-tab to the next field after something (at least 1 character) has been scanned?  Is there a way to make it auto-tab after at least 1 character is scanned, or will it simply truncate everything after the 1st character?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 26, 2018 Apr 26, 2018

Copy link to clipboard

Copied

Set the character limit to 1...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 26, 2018 Apr 26, 2018

Copy link to clipboard

Copied

For the "on blur" action you can use the "setFocus" method of the field you want to tab to.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 26, 2018 Apr 26, 2018

Copy link to clipboard

Copied

If you set the character limit to one, you won't be able to scan in more than 1 character. But you can use a custom keystroke script to check if there is at least one character entered in the field, and if so, set the focus to another field. Here's a sample script that should do what you want:

// Custom function placed in a document-level JavaScript

function SetFocusToNextField(sFieldname) {

    // Get all of the characters that have been entered into this field

    var sChars = AFMergeChange(event);

    // If there are 1 or more characters, set the focus to the next field

    if (sChars.length > 0) {

        getField(sFieldname).setFocus();

    }

}

And call it like this in the Keystroke event of the text field that accepts the scanned characters:

// Custom Keystroke script

SetFocusToNextField("Text2");

where "Text2" is the name of the field you want to set the focus to. Now, when one or more characters are entered into the text field, the focus will automatically be set to the specified field.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 27, 2018 Apr 27, 2018

Copy link to clipboard

Copied

I'm not a software engineer, so please excuse my newbie ignorance.  Are both of these scrips a Custom Keystroke Script?  If so, there is only 1 box I can copy and paste the script into.  How do I combine both sets of scripts?

Or, did you mean that I need to customize the 1st script as this (I bolded my modifications):

// Custom function placed in a document-level JavaScript

function SetFocusToNextField("Text2") {

    // Get all of the characters that have been entered into this field

    var sChars = AFMergeChange(event);

    // If there are more than 1 characters, set the focus to the next field

    if (sChars.length > 0) {

        getField("Text2").setFocus();

    }

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 27, 2018 Apr 27, 2018

Copy link to clipboard

Copied

The first multiline script is intended to be placed in a document-level JavaScript. You have to do it this way due to a quirk in Acrobat that occurs when you use one of the built-in functions (AFMergeChange).

The second one-line script is what you place in the Keystroke script of the field.

If you don't know how to create a document-level JavaScript, post again, and include the version of Acrobat that you're using.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 27, 2018 Apr 27, 2018

Copy link to clipboard

Copied

Yes!! That worked!! Thank you so much for your help!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 08, 2020 Oct 08, 2020

Copy link to clipboard

Copied

Hello,

I'm new to all of this, so do I start from Custom and place this in Keystroke?  I'm trying to do the same but entering the date MM/DD/YYY.  Each field is separate (MM,DD,YYYY).  What is Document-level Java Script?  Again, I AM NEWWWWWW. 

Thank you for your patience and time. Many of the old links don't work because they are old and pages have been removed. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 08, 2020 Oct 08, 2020

Copy link to clipboard

Copied

LATEST

Yes, that's correct. You need to apply it to each one of those fields.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2020 Jan 28, 2020

Copy link to clipboard

Copied

Is this exactly what you typr into the custom JavaScript Field becaue I have several syntax errors. Please help

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 29, 2020 Jan 29, 2020

Copy link to clipboard

Copied

Such as?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines