Skip to main content
Known Participant
November 20, 2016
Question

add an "or" statement

  • November 20, 2016
  • 2 replies
  • 371 views

Right now I have the following script in my form:

//</ACRO_script>
//</AcroForm>

//<AcroForm>
//<ACRO_source>AreaDuesQty:Calculate</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:AreaDuesQty:Calculate ***********/
var A = +this.getField("ChptTotQty").value;
var B = +this.getField("AffTotQty").value;

if( A > 0 ) event.value = A + B;
else event.value = "";

It works great as long as there is a number in the "ChptTotQty" But, I want it to give me a number whether there is a number in "ChptTotQty" or "AffTotQty" field. Is there a way to make "if ( A > 0 ) event.value = A + B;"  Into "if ( A > 0 ) or ( B > 0 ) event.value = A + B;"

Any help would be greatly appreciated.

Thank You

This topic has been closed for replies.

2 replies

Participant
July 14, 2019

Try this code:

var A = this.getField("ChptTotQty").value;

var B = this.getField("AffTotQty").value;

if( A > 0 || B>0 ) {

event.value = A + B;

}
else {

event.value = "";

}

Known Participant
November 20, 2016

I am so sorry, I found this answer in one of my earlier questions.

I have two variables A & B. I want to say "if( A or B &gt; 0 ) event.value = A + B"

I am hoping that the link above will take you to the answer when you click on it. I am not sure it will work.

Chris