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

How to auto-tab only some fields in a form with multiple fields

Community Beginner ,
Aug 09, 2023 Aug 09, 2023

I have a form that was originally for written communication but it was requested to make it fillable on the computer.  I have tried javascript but I haven't been able to make it work.  I think because I have multiple form fields but I only want it to auto-tab on 2 of the fields.Screenshot 2023-08-09 080658.pngexpand image

This is part of the form. As you can see, I have multiple form fields (and more that are not showing).  The only section I was wanting to auto-tab on is the 3 lines for "Note".  I know I can change the format to have one text box with the multi-line setting, but I was hoping to keep the form as close to the printed one as possible.

TOPICS
Edit and convert PDFs , How to , JavaScript , PDF , PDF forms
2.3K
Translate
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Aug 09, 2023 Aug 09, 2023

Here is a simple script to auto tab to next field once field is 'full' (in field options turn off 'scroll long text')put script in 'Custom keystroke script' of the first 'Note' field and change "Note2" to your actual field name for second note field:

if ( event.fieldFull || event.willCommit )
this.getField("Note2").setFocus();

You can also find more script sample here:

https://acrobatusers.com/forum/forms-acrobat/auto-advancing-form-fields-adobe-acrobat-9-standard/ 

View solution in original post

Translate
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 18, 2024 Oct 18, 2024

Place this as Document level script:

function tab_next(next_field_name){
if(AFMergeChange(event).length === event.target.charLimit)
this.getField(next_field_name).setFocus();}

Then call a function from custom keystroke script of your fields:

tab_next("field name goes here");

Replace field name goes here with the name of the field you wish to tab to.

View solution in original post

Translate
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 ,
Aug 09, 2023 Aug 09, 2023

Here is a simple script to auto tab to next field once field is 'full' (in field options turn off 'scroll long text')put script in 'Custom keystroke script' of the first 'Note' field and change "Note2" to your actual field name for second note field:

if ( event.fieldFull || event.willCommit )
this.getField("Note2").setFocus();

You can also find more script sample here:

https://acrobatusers.com/forum/forms-acrobat/auto-advancing-form-fields-adobe-acrobat-9-standard/ 

Translate
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 ,
Aug 10, 2023 Aug 10, 2023

I do not know how to "put script in 'Custom keystroke script'.

I was able to turn off 'scroll long text' and I can see where to put a character limit.

I am very new to javascript.

I could not make the other sample work either.  I'm not sure what I'm missing.

Translate
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 ,
Aug 10, 2023 Aug 10, 2023

Go to field properties → Format tab, select 'Custom' and then you will see 'Custom keystroke script'.

tempsnip.pngexpand image

Translate
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 ,
Aug 10, 2023 Aug 10, 2023

That worked perfectly.  Thank you so much for your help!

Translate
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 18, 2024 Oct 18, 2024

Hello! This was extremely helpful but how do I get it to work without having to press every letter/number twice before it autotabs to the next box? I have the limit for each box set to 1 but each time I try to type the next letter/number my computer "dings" and then it will autotab. Is there a way around the "ding"?

Translate
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 18, 2024 Oct 18, 2024

Place this as Document level script:

function tab_next(next_field_name){
if(AFMergeChange(event).length === event.target.charLimit)
this.getField(next_field_name).setFocus();}

Then call a function from custom keystroke script of your fields:

tab_next("field name goes here");

Replace field name goes here with the name of the field you wish to tab to.

Translate
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 ,
Feb 24, 2025 Feb 24, 2025
LATEST

I'm using this to auto advance a line by line paragraph in a document.  How do I prevent it from cutting off the last word, or in a sense word wrap to the next line?  For example the lines in this image should end with "words" or move the entire word "words" to the next line.  

Kirsten34220160t2qw_0-1740419691455.pngexpand image

 

Translate
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