5 Replies Latest reply on Aug 23, 2017 3:09 PM by try67

    Javascript calculation after values entered.

    Walb0244 Level 1

      I currently have the following java script in a adobe pdf to perform calculations.  One of the problems I am running into is the form is performing the calculations live.  I do not want the calculations to be performed till values are entered.  So currently the 3 text boxes are "Neck1", "Neck2" and "Neck3".  Once values are entered into these boxes I would like to perform the average calculation.  Any help would be appreciated.  I am not experience with JavaScript so please be very detailed with answers.



      // Custom calculation script (function () {


      // Get the field values, as numbers


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

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

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


      var nTotal = (v1 + v2 + v3)


      var nAverage = (nTotal / 3)


      var nRounded = Math.round(nAverage / .5)*.5;


      event.value = nRounded; })();