Skip to main content
JamesEisert
Participating Frequently
January 20, 2020
Question

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

  • January 20, 2020
  • 1 reply
  • 347 views

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

 

 

 

 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
January 20, 2020

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}

JamesEisert
Participating Frequently
January 20, 2020

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?

try67
Community Expert
Community Expert
January 20, 2020

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.