Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Position cursor in text field when form is opened

Avatar

Level 2

Another newbee question I'm afraid!

I want to position the cursor in a text field when a user opens the form. I can't find a way to do it but I'm pretty sure it's straightforward!

Also, can I remove fields from the tab order?

Thanks (for your help and patience!)

7 Replies

Avatar

Level 10

Hi,

You would select the object that you want to receive focus and put the following in the docReady event.

xfa.host.setFocus("this");

The docReady event is a good one to use, because it only fires once.

The tab order can be set in the Tab Order tab. Depending on the version of LC Designer that you have, the flexibility will vary. However I would do this as a last step, as any changes can throw the tab order out of sequence.

Note that tab order is greatly affected by the relevant x/y coordinates of objects and where objects are in separate subforms.

Hope this helps,

Niall

Avatar

Level 2

Niall, you are a star! Thanks so much.

Avatar

Former Community Member

Sorry to rain on the parade but in this circumstance that will not work. The issue has to do with how and when XFA commands and objects are available to Acrobat. The cursor is controlled by teh Acrobat layer and until the form is ready (handed to the user) Acrobat does not know about the XFA objects. So

you will have to use an Acrobat command and reference th efield by means of an AcroForm structure to Accomplish this. I have included a sample that shows how to do it. This was certainly the case in version 8 (I have not touched this since then ...so if I am wrong please update this thread)

Paul

Avatar

Level 2

Thanks Paul. This is version 8.2.1.4029.1.523496 and as far as I can see the function as described by Niall does what it should.

Avatar

Level 10

Hi Paul,

Here is a version with the setFocus: https://acrobat.com/#d=2zbOAEq3AHzxSWexle0PQA

I can only test back to Reader v8.2 at the moment. I would have thought that the docReady event would have been firing late enough in the render process to work. I will try and test some more.

Tim, Paul raises a very valid point - you should test back to the version of Acrobat/Reader that your users will be using.

Niall

Avatar

Level 2

So that all works fine until I try to set docready on a TextField where the script type is set to FormCalc but I can't see how to change this to JavaScript.

Sorry to be a nuisance!

Avatar

Level 2

Sorry, found out how to do it!