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

Cursor focus in first form field

Community Beginner ,
Feb 03, 2016 Feb 03, 2016

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
4.1K
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

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.

Translate
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.

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

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!

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

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!

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

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.

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

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.pngexpand imageCursor focus in first form field 02.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 ,
Feb 25, 2020 Feb 25, 2020
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

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