How to programmatically focus a field in a dialog?

Explorer ,
Jan 30, 2018

Copy link to clipboard

Copied

I don't see a focus() method documented under the dialog documentation but when I inspect the dialog keys I see that one of them is ​focus​. Is there a way to accomplish this?

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

209

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

How to programmatically focus a field in a dialog?

Explorer ,
Jan 30, 2018

Copy link to clipboard

Copied

I don't see a focus() method documented under the dialog documentation but when I inspect the dialog keys I see that one of them is ​focus​. Is there a way to accomplish this?

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

210

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
Jan 30, 2018 0
Most Valuable Participant ,
Jan 30, 2018

Copy link to clipboard

Copied

Where did you see that?

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
Reply
Loading...
Jan 30, 2018 0
Adobe Community Professional ,
Jan 30, 2018

Copy link to clipboard

Copied

Yes, there is an undocumented Focus function in the runtime dialog object.  Its input is the item_id of target field.

There are many undocumented functions, properties, and options for the dialog object.  Some are undocumented because they are incomplete, or never worked out. But for some it's just like Adobe just decided scripting wasn't important and stopped development/support. Documenting something means you have to support it.

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
Reply
Loading...
Jan 30, 2018 1
Most Valuable Participant ,
Jan 30, 2018

Copy link to clipboard

Copied

Yeah, I'm aware of many of these functions (like the image loading one), but wasn't aware of the focus option, except for the first_tab parameter. Neat.

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
Reply
Loading...
Jan 30, 2018 0
Explorer ,
Jan 30, 2018

Copy link to clipboard

Copied

I tried doing dialog.docus("myid"); but it doesn't seem to work. I am trying to focus the field they just left if the validation failed. But maybe I shouldn't use this function since it's not supported. So far using undocumented features has not been promising. I tried using a multi-column list view which worked great on Acrobat on Mac but then when I tested on Windows it completely slowed down Acrobat and it constantly froze so I had to switch it back to a regular list view.

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
Reply
Loading...
Jan 30, 2018 0
Adobe Community Professional ,
Jan 30, 2018

Copy link to clipboard

Copied

you do know it's spelled "focus" not "docus"

The function does work, but it's going to have problems if it's used in a transition state. So what do you mean by "validation". Do you mean the "validate" function that is called before the dialog exits, or is a text field item_id function?  I've only use this function before on a button function.  It worked fine. But if the user is tabbing or clicking onto another field there are a few different things going on and it may not work as well.

Are there any errors reported:

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
Reply
Loading...
Jan 30, 2018 0
Explorer ,
Jan 30, 2018

Copy link to clipboard

Copied

Haha yes, I meant "focus", sorry. It's called in an item_id function. No errors.

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
Reply
Loading...
Jan 30, 2018 0
Adobe Community Professional ,
Jan 30, 2018

Copy link to clipboard

Copied

Well then unfortunately it's probably not going to work the way you want   Too bad, because that's a perfect use for it.

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
Reply
Loading...
Jan 30, 2018 1
Adobe Community Professional ,
Jan 31, 2018

Copy link to clipboard

Copied

Is there any documentation on undocumented functions?

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
Reply
Loading...
Jan 31, 2018 1
Most Valuable Participant ,
Jan 31, 2018

Copy link to clipboard

Copied

Sure. It's available in a book written in Ancient Sanskrit, sold only by Blockbuster.

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
Reply
Loading...
Jan 31, 2018 1
Adobe Community Professional ,
Jan 31, 2018

Copy link to clipboard

Copied

Ha ha, I've got a list I've collected.  But half of it doesn't work, either because I don't know the real usage or inputs, or because it never worked.   Here's one I never figured out, and Joel just brought up the other day, "field.doAction()".  Where field is a regular form field.

There have always been undocumented functions and properties shown in examples in the Acrobat JS Ref. For example Matrix2D is undocumented, but it's used in the "doc.addLink()" sample.

There are also lots of undocumented functions and properties used in the old folder level JS files that installed in previous versions of Acrobat. If you can get a hold of these, they are a gold mine.

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
Reply
Loading...
Jan 31, 2018 1