go to a field object

Nov 06, 2019

Copy link to clipboard

Copied

I am wondering if i could get some help in writing a simple script to go to a specific text field. I am working in Acrobat

 

for example when a checkbox is actioned (ticked) to go to a relating field where comments are to be made.

 

I know there is the basic pageNum = 1; etc. coding, but that will only take me to a page, not a specified field.

Place this script as a "mouse up" action in the checkbox:

 

if (event.target.value != "Off") { // if the checkbox is ticked
this.getField("comments").setFocus(); // the target field is activated
}

 

You just have to adjust the target field's name.

TOPICS
Acrobat SDK and JavaScript, PDF forms

Views

58

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

go to a field object

Nov 06, 2019

Copy link to clipboard

Copied

I am wondering if i could get some help in writing a simple script to go to a specific text field. I am working in Acrobat

 

for example when a checkbox is actioned (ticked) to go to a relating field where comments are to be made.

 

I know there is the basic pageNum = 1; etc. coding, but that will only take me to a page, not a specified field.

Place this script as a "mouse up" action in the checkbox:

 

if (event.target.value != "Off") { // if the checkbox is ticked
this.getField("comments").setFocus(); // the target field is activated
}

 

You just have to adjust the target field's name.

TOPICS
Acrobat SDK and JavaScript, PDF forms

Views

59

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
Nov 06, 2019 0
Nov 06, 2019

Copy link to clipboard

Copied

The buzzword here is "focus". The field with focus is, if it is a fill-in form, the one where the cursor appears, and where the user types.

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...
Nov 06, 2019 0
Nov 06, 2019

Copy link to clipboard

Copied

Place this script as a "mouse up" action in the checkbox:

 

if (event.target.value != "Off") { // if the checkbox is ticked
this.getField("comments").setFocus(); // the target field is activated
}

 

You just have to adjust the target field's name.

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...
Nov 06, 2019 0
Nov 06, 2019

Copy link to clipboard

Copied

Perfect! Thank you JR_Boulay

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...
Nov 06, 2019 0