Initializing global variables

Explorer ,
Apr 22, 2022 Apr 22, 2022

Copy link to clipboard

Copied

Thanks to the help from this community I am getting less inept at javascript programming. Now maybe I can get help one more time.

 

How do I set an "initial value" for a global variable? For example, I need the default value to be "true" as the script begins to run.

 

I hope that question makes sense.

TOPICS
PDF forms

Views

91

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 2 Correct answers

Adobe Community Professional , Apr 22, 2022 Apr 22, 2022

Can't you set the variable at the begin of the script?

Likes

Translate

Translate
Adobe Community Professional , Apr 22, 2022 Apr 22, 2022

You can declare variable at Document level.

EDIT: Sorry I missread. As Bernd said declare variable at begining of script or if you need to access variable in different scripts, then use at document level.

Likes

Translate

Translate
Adobe Community Professional ,
Apr 22, 2022 Apr 22, 2022

Copy link to clipboard

Copied

Can't you set the variable at the begin of the script?

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
Adobe Community Professional ,
Apr 22, 2022 Apr 22, 2022

Copy link to clipboard

Copied

You can declare variable at Document level.

EDIT: Sorry I missread. As Bernd said declare variable at begining of script or if you need to access variable in different scripts, then use at document level.

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 ,
Apr 23, 2022 Apr 23, 2022

Copy link to clipboard

Copied

LATEST

Yes, I finally figured out how to get some script added at the document level.

 

This is a pretty slick product but the documentation leaves something to be desired. I went through at least a half dozen google hits before one of them used a screen shot to get me to the right place.

 

Thanks for the reply.

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