Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


using global values in all local (fieldrelated) Javascriptcode

Explorer ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

I use Adobe Acrobat Pro-DC

In my form, I want to define some values in a global way , that can be used in all local (fieldrelated) Javascriptcode. Such as predefined colors, that are used, when a event occurs.  I read that this can be defined directly in the Form, but do not find the position, where to defne and did not find the way, they are localy accessed after being defined global.

Sorry for this perhaps very simple question.

-Ben

TOPICS
PDF forms

Views

331

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
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Jun 26, 2021 Jun 26, 2021
You can do it in document javascript, while in prepare form tool click on 'more' and select document javascript or press SHIFT+D, name your script and click on 'add' delete everything there is when you open window and write your code there, you can then call variable from fields script. EDIT: variable declared outside of function can be used globally,for example: if you call variable in  field calculation script that is not in function you can call it in another field.

Likes

Translate

Translate
Adobe Community Professional ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

You can do it in document javascript, while in prepare form tool click on 'more' and select document javascript or press SHIFT+D, name your script and click on 'add' delete everything there is when you open window and write your code there, you can then call variable from fields script.

EDIT: variable declared outside of function can be used globally,for example: if you call variable in  field calculation script that is not in function you can call it in another field.

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
community guidelines
LEGEND ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

You mean, in all field of the same form, or in different forms?

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
community guidelines
Explorer ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

LATEST

yes, defining once and using everywhere in the form. I have to check the solution, that Nesa sent.

-ben

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
community guidelines