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

Cursor focus in first form field

Community Beginner ,
Feb 03, 2016 Feb 03, 2016

Copy link to clipboard

Copied

I have Adobe Acrobat Pro XI.  How do I make the cursor appear in the first form field when the document is opened?

TOPICS
Acrobat SDK and JavaScript , Windows

Views

2.1K

Likes

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

Community Expert , Feb 03, 2016 Feb 03, 2016

Let's say the field is called "Text1". Go to Tools - JavaScript - Document JavaScripts and add a new script (let's call it "load") with this code:

this.getField("Text1").setFocus();

Click OK, save the file and you're done.

Likes

Translate

Translate
Community Expert ,
Feb 03, 2016 Feb 03, 2016

Copy link to clipboard

Copied

Let's say the field is called "Text1". Go to Tools - JavaScript - Document JavaScripts and add a new script (let's call it "load") with this code:

this.getField("Text1").setFocus();

Click OK, save the file and you're done.

Likes

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 ,
Feb 03, 2016 Feb 03, 2016

Copy link to clipboard

Copied

You.Are.Awesome

I have been trying to figure this out for two days!

I did what you said and it worked immediately!

Muah!  Thanks!

Likes

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 ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

Hi!  I did that and it does not focus on my PDF... Do I have to call the function somewhere? If so, where do I have to call it?

Thanks so much for the help!

Likes

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 ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

You have to put the code where I described in my reply above... And don't put it inside a function. Delete any code that is automatically generated when you create the script.

Likes

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 ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

I know this is an old thread but for reasons, hopefully I can still get help, I don't understand I cannot get the script to correctly work. I created a form in MS Word, saved it as a PDF, Opened it in Acrobat XI Pro, created a form, added the load script. When I open the document in Acrobat the cursor is at the top of the page just before the text.

 

I'll admit I'm a real dummy and attempted to just follow the instructions. I noticed that Acrobat added more stuff to the Javascript and I assumed that it was needed. For me Javascript is like talking to a fish. 

Cursor focus in first form field 01.pngCursor focus in first form field 02.png

 

Likes

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 ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

LATEST

OK reread the entire post and saw "And don't put it inside a function. Delete any code that is automatically generated when you create the script."

 

Now it works! Thanks

Likes

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