26 Replies Latest reply on Sep 20, 2017 11:09 AM by Karl Heinz Kremer

    Basic Calculation & Display Text (Custom Calculation script)

    Throwzone2001

      Ok, I've been searching for 3 days on this answer, but everytime I change something I break my form again.

       

      I have 4 text boxes:

       

      Two with Currency variables.

      In the 3rd box, they need to subtract in.

      In the 4th box, it needs to display Over/Short/Balanced

       

      I've got the form working with just that information. My problem is that if the first two boxes are blank, the other two need to be blank. Or in otherwords, if a calculation hasn't taken place, Box 3 & 4 need to remain blank till Box 1 & 2 are populated.

       

      In Box 3 for the Calculation Script, I've got this:

      event.value = ( this.getField("Actual_Cash_in_TCR").value - this.getField("TCR_Reported_Totals").value );

       

      In Box 4 for the Calculation Script, I've got this:

      var n = this.getField("Amount").value;

      if( n > 0) event.value = "Over";

      else if ( n < 0) event.value = "Short";

      else event.value = "Balanced";

       

      Where am I messing up, what needs to be added and where?

       

       

      Adobe Acrobat Pro DC 2015.006.30355 for Windows.