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
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.
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.
Copy link to clipboard
Copied
You mean, in all field of the same form, or in different forms?
Copy link to clipboard
Copied
yes, defining once and using everywhere in the form. I have to check the solution, that Nesa sent.
-ben