Javascript : Detect the source of an event

Adobe Community Professional ,
Oct 21, 2019

Copy link to clipboard

Copied

Hi

 

I would like my function to detect the source of the event (onFocus vs onBlur) as in the sample script below.
Is it possible ?

I just spent more than an hour in the Acrobat JS documentation, I did not find anything and I have itchy eyes ...

 

myFunction() {
if (event is onFocus) {// blablabla;}
else if (event is onBlur) {// blebleble;}
}

 

Thank you

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Check event.name and event.type.

TOPICS
Acrobat SDK and JavaScript, PDF forms

Views

97

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

Javascript : Detect the source of an event

Adobe Community Professional ,
Oct 21, 2019

Copy link to clipboard

Copied

Hi

 

I would like my function to detect the source of the event (onFocus vs onBlur) as in the sample script below.
Is it possible ?

I just spent more than an hour in the Acrobat JS documentation, I did not find anything and I have itchy eyes ...

 

myFunction() {
if (event is onFocus) {// blablabla;}
else if (event is onBlur) {// blebleble;}
}

 

Thank you

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Check event.name and event.type.

TOPICS
Acrobat SDK and JavaScript, PDF forms

Views

98

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
Oct 21, 2019 0
Most Valuable Participant ,
Oct 21, 2019

Copy link to clipboard

Copied

Have the event pass this info in a parameter.

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...
Oct 21, 2019 0
Adobe Community Professional ,
Oct 22, 2019

Copy link to clipboard

Copied

Check event.name and event.type.

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...
Oct 22, 2019 1
Adobe Community Professional ,
Oct 22, 2019

Copy link to clipboard

Copied

Thank you, I will check 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...
Oct 22, 2019 0
Most Valuable Participant ,
Oct 22, 2019

Copy link to clipboard

Copied

Try event.source.name ... Keep in mind that event.source is sometimes null (for example, when resetting the form), so check for that first.

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...
Oct 22, 2019 1
Adobe Community Professional ,
Oct 22, 2019

Copy link to clipboard

Copied

"Check event.name"

 

Got it!

Thank you

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...
Oct 22, 2019 0