1 Reply Latest reply on Mar 4, 2008 8:01 AM by gkaiseril

    Subtraction calculation not working

      I have a script in Adobe Acrobat 6 that I'm having trouble with. I need to add two values, then subtract one value. For some reason, it's not working. Here's the script:

      var a = this.getField("Text69");
      var b = this.getField("TotalEndFund");
      var c = this.getField("Text49");
      event.value=(a.value+b.value) - c.value

      Any ideas? Thanks!
        • 1. Re: Subtraction calculation not working
          gkaiseril MVP & Adobe Community Professional
          What is not working?

          It is snowing here and my crystal ball is looking a snow globe.

          Are there any error messages in the JavaScirpt console?
          What is the displayed result of the calculation?
          What is the displayed result when the field's format is set to "None"?
          What are the values of the imputs?
          What are the types of the inputs?

          var a = this.getField("Text69");
          var b = this.getField("TotalEndFund");
          var c = this.getField("Text49");
          // some debugging code
          console.show();
          console.clear();
          console.println("Text69 value: " + a.value);
          console.println("Text69 typeof: " + (typeof a.value));
          console.println("TotalEndFund value: " + b.value);
          console.println("TotalEndFund typeof: " + (typeof b.value));
          console.println("Text49 value: " + c.value);
          console.println("Text49 typeof: " + (typeof c.value));
          console.println("(a.value+b.value) - c.value = " +((a.value+b.value) - c.value));
          console.println("(Number(a.value) + b.value) - c.value = " +((Number(a.value) + b.value) - c.value));
          // end debugging code
          event.value=(a.value+b.value) - c.value