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

AND ... OR type functions in scripting? Double IF'ing?

New Here ,
Jan 20, 2020 Jan 20, 2020

Copy link to clipboard

Copied

Hello again all,

 

I have a field that calculates something. It works.

 

a sample line...

 

if (this.getField("Dropdown2.15.2").value=="ASTRODYNAMICS")event.value = ( this.getField("INTELLECT").value + this.getField("INTELLECT").value ) + this.getField("WILL").value;

 

However, I want to also add exactly 10 more if FieldA="MyTEXTValue". How would I do this?

 

Thanks very much

 

 

 

 

TOPICS
Acrobat SDK and JavaScript

Views

195

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
Community Expert ,
Jan 20, 2020 Jan 20, 2020

Copy link to clipboard

Copied

Yes, all of that is possible. You should study the core JS-syntax, but basically you do it like this:

 

AND:

if (condition1 && condition2 && condition3) { do action }

 

OR:

if (condition1 || condition2 || condition3) { do action }

 

Combined operators in a single if-statement:

if (condition1 || (condition2 && condition3)) { do action }

 

If-else if-else structure:

if (condition1) { do action1}

else if (condition2) {do action2}

else if (condition3) {do action3}

else {do default action}

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
New Here ,
Jan 20, 2020 Jan 20, 2020

Copy link to clipboard

Copied

Thank you Try67. 

 

I have tried to find a list of commands and such for acrobat javascript, but it isnt easy to find surpringly. I am trying w3schools.com for it. Any other place I should look?

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
Community Expert ,
Jan 20, 2020 Jan 20, 2020

Copy link to clipboard

Copied

LATEST

The Acrobat JS documentation doesn't contain information about core-JS function. The W3Schools site is a good resource, but you have to make sure to only use the core stuff, ie nothing browser-related, as those commands won't work in Acrobat.

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