2 Replies Latest reply on May 9, 2015 4:10 AM by SSGNG

    Logic problem.  JavaScript wont add values properly


      Simple logic problem.  I have radio buttons set at values of 1 or 0, but the simple add feature adobe has wont add it up?


      Base story, I need to display the value of how many NO GOs there are, then multiply the amount of NO GOs against a set value each is worth.

      then subtract that from 100 to get an academic score.


      Code for determining value for one set of radio buttons;


      switch(this.getField("Group 1").value)


      case "GO":

      event.value = 0;


      case "NO GO":

      event.value = 1;




      Under the calculate tab, I then use the first calculate ( sum + ) selection to determine all fields i wish to add up (Total of 24 selections possible) Field name is (TOTALNG)

      Following that i have a hidden field which multiplies the previous value TOTALNG * 4 (Representing the score value i want to determine each NO GO as) and then displays

      the final total which I simply subtract from 100.


      Issue is, it doesnt display the correct initial value of NO GO's. It is always 1 count behind to what it should be. I even select the radio button to go which resets the value to 0, but down at the total it counts as if there is one selected and gives a value of 4.


      Seems a way simple code so far, even to me (If the way im putting this together doesnt tell you I know little) But I dont understand what I can be missing. I've even set a control field of 0 to add in now just to see if it needs another value to add against just in case there is only one NO GO to add.


      Any insight? My form is a probably a mess, but i think the code is simply laid out if anyone is willing to look at it and laugh for a second at my work.