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

add an "or" statement

Community Beginner ,
Nov 20, 2016 Nov 20, 2016

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

TOPICS
Acrobat SDK and JavaScript , Windows
340
Translate
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 Beginner ,
Nov 20, 2016 Nov 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

Translate
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 ,
Jul 14, 2019 Jul 14, 2019
LATEST

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 = "";

}

Translate
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