1 Reply Latest reply on Feb 2, 2009 12:47 PM by gkaiseril

    Need help with Acrobat Calculation

      Hi,

      I created a Mileage form in PDF to where

      Mileage = Odometer Start - Odometer End

      But, if no Odometer Start or End is entered then a person can enter a

      Mileage # into that box, but it won't allow me

      Could someone help?

      I have this so far..

      //
      var f = this.getField("Odo End Line 1");
      var g = this.getField("Odo Start Line 1");
      var h = this.getField("Mileage Line 1");
      event.value = f.value - g.value;
      //
        • 1. Re: Need help with Acrobat Calculation
          gkaiseril MVP & Adobe Community Professional
          Have you set the input fields to "read only"?

          For the "Mileage Line 1", you can use the following custom calculation script with the supression of the calculation if either entery field is empty and the entries are logical:

          var f = this.getField("Odo End Line 1").value;
          var g = this.getField("Odo Start Line 1").value;
          event.value = ''; // clear field

          // only calculate if either string is empty and ending value is greater than the starting value
          if(f.toString() != "" & (g.toString() != "" & f > g))
          event.value = f - g;
          if(f <=g )
          app.alert("Ending milage needs to be larger than starting milage");