5 Replies Latest reply on Oct 10, 2017 8:35 AM by try67

    need help with Adobe Acrobat Pro DC custom calculation script

    drwnicc Level 1

      I'm trying to create a form with:

      1. a series of numerators and denominators to calculate

      2. if the field is left blank, it is not included in the calculation

      3. the calculation to be updated in real time, and not wait for each field to have a number in it before it calculates.

       

      This is the only calculation in the form, so changing the calculation order is not used.

      In the document javascript, I have

          this.calculateNow();

       

      and in the custom calculation script for the field, I have

          (function () {

        

          var v1 = +getField("Text1").value;

          var v2 = +getField("Text2").value;

          var v3 = +getField("Text3").value;

          var v4 = +getField("Text4").value;

          var v5 = +getField("Text5").value;

          var v6 = +getField("Text6").value;

          var v7 = +getField("Text7").value;

          var v8 = +getField("Text8").value;

          var v9 = +getField("Text9").value;

          var v10 = +getField("Text10").value;

        

          event.value = (v2 * v4 * v6 * v8 * v10) !== 0 ? ((v1 * v3 * v5 * v7 * v9) / (v2 * v4 * v6 * v8 * v10)) : "";

          })();

       

      The issues I'm having:

      1. that the calculation does not calculate in real time

      2. all fields still have to be entered for the calculation to occur.

      3. if zero is entered, the calculation will not run.