28 Replies Latest reply on Feb 13, 2017 1:37 PM by Eileen987

    Subtraction from multiple fields result is incorrect.

    Eileen987

      I have been attempting to calculate a subtraction javascript in acrobat X. (i am an inexperienced javascript coder and found part of this this in a search online.  I made some assumptions and elaborated the rest)

       

      This is my javascript:

       

      // Get first field value

       

      var v1 = getField("Qty Recd").value;

      // Get second field value

       

      var v2 = getField("Text4.0.1").value;

      // Get third field value

       

      var v3 = getField("Text4.1.1").value;

      // Get fourth field value

       

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

      // Get fifth field value

       

      var v5 = getField("Text4.3.1").value;

      // Get sixth field value

       

      var v6 = getField("Text4.4.1").value;

      // Get seventh field value

       

      var v7 = getField("Text4.5.1").value;

      // Get eighth field value

       

      var v8 = getField("Text4.6.1").value;

      // Get ninth field value

       

      var v9 = getField("Text4.7.1").value;

      // Get tenth field value

       

      var v10 = getField("Text4.8.1").value;

      // Get eleventh field value

       

      var v11 = getField("Text4.9.1").value;

       

      // Set this field value equal to the difference

      event.value = v1-v2;-v3;-v4;-v5;-v6;-v7;-v8;-v9;-v10;-v11;-v12;-v13;-v14

       

      When I test the calculation, initially the result is correct.  However, when I change one of the values to another number or delete it, the result continues to subtract what was initially entered in the field.  How do I correct this?  .

       

      I have been trying different things and searching for help for two days.

      Can anyone figure out what I am doing wrong?  And then help me correct it?

      Thank you Emelone