• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

615

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

Community Expert , 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.

Votes

Translate

Translate
Community Expert ,
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.

Votes

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?

Votes

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

Votes

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