2 Replies Latest reply on Aug 24, 2017 4:03 PM by annab387

    Simple Java not working


      I'm sure there's an exceedingly simple answer I'm missing, but I can't seem to get this to work right.  All I want to do is subtract 2 from the sum value if the radio button ABCs is marked "NA" but it seems that no matter what I do, it still displays 8.

      Name: ABCs

      Radio Button Choice: NA


      Here was my best shot:



      (function () {


          var sum = 8;


      if(ABCs.value == "NA"){

      sum = sum -2;}


      else {sum = sum;}


          event.value = sum;




      Thank you for your help!

        • 1. Re: Simple Java not working
          try67 MVP & Adobe Community Professional

          1. It's JavaScript, not Java.

          2. I moved your question to the JavaScript forum

          3. Your code has some mistakes in it. Use this instead:


          (function () {
              var sum = 8;
              if (this.getField("ABCs").value == "NA") {
                  sum -= 2;
              event.value = sum;
          1 person found this helpful
          • 2. Re: Simple Java not working
            annab387 Level 1

            Thank you for the clarification regarding nomenclature.

            Your assistance with the javascript is much appreciated and I can now make this project work.

            I shall now rejoin the ranks of the programming neophytes and endeavor not to darken your forums with further puerile inanity.