2 Replies Latest reply on Oct 2, 2017 11:25 AM by dhhsc84757271

    Calculation will not stop


      I am using Adobe Pro and I am trying to use a radio button to complete a calculation.  There's text field ("CourseName"), another field formatted as a number field ("Hours") and the radio button ("HourType").  The user enters the course name, and then enters how many credit hours received for the course.  The radio button performs a calculation depending on if the user selects Semester Hours (export value is SH) or Quarter Hours (export value is QH).  If the user selects "SH" then nothing changes, but if they select "QH", the "Hours" value is multiplied by 0.6667.   I'm using the following custom calculation script on the "Hours" field:


      var total = Number(this.getField("Hours").value);

      var type = this.getField("HourType").value;

      if (type=="QH") {

         event.value = total * 0.6667;

      } else

         event.value = total;


      The script works fine until I toggle back and forth. Each time I go from QH to SH and then back to QH..it performs the calculation again, which shrinks the number for the QH.  I need to be able to alternate between the two radio button options and not have the QH option continuously recalculate.

      So, if 15 is entered into "Hours" and the user selects the "QH" button, the "Hours" field should change to 10.  If the user changes their mind and selects the "SH" button, the "Hours" should revert back to 15......and if they decide to go back to "QH", the "Hours" should calculate 10 again...right now, it's dropping to 6.67.


      I hope I'm just overlooking something fairly simple...any input would be greatly appreciated