9 Replies Latest reply on Dec 18, 2017 12:00 PM by stepheng54012748

    Writing a validation script to javascript......

    stepheng54012748 Level 1

      I wrote a Javascript in Acrobat for a form that I'm working on.  The result could be either a positive number or a negative number that populates as my answer. I30 is supposed to yield the difference between I28 less I29.  If I28 populates a number $1,000 and nothing shows in I29 then the result in I30 would be $1,000.  This is correct.  If nothing shows in I28 and $1,000 populates in I29 then I30 is supposed to show as (1,000) because I28 less I29 would equal (1,000).  This result is not showing up.  I cannot figure out why.  I'm wondering if my validation script is the issue.  I've included this below the script.  Any suggestions?  Thank you so much for any input.  (Note:  I am learning and trying to figure out how to write this code)


      var theField = this.getField("l28");

      var theValue = theField.value;

      var theField2 = this.getField("l29");

      var theValue2 = theField2.value;


      if (+theValue - +theValue2 > -10000000000.01) {

          this.getField("l30").value = (+theValue - +theValue2);


      else {

           this.getField("l30").value = "";  



      Custom validation script as follows:


      if (event.value < .00001) event.value = "";