2 Replies Latest reply on Feb 6, 2016 7:27 AM by stealthrs

    If/Then Statement Logic Check

    stealthrs Level 1

      Can someone double-check my code?


      I want Question2e to be UNCHECKED until all questions A-D are answered... If Yes (or 0) is indicated in any of the answers, then I need Question2e to be answered as Yes (0).  If questions A-D are all no, then No (or 1) can be answered for Question2e


      What am I missing?


      var f = this.getField("Question2a");

      var g = this.getField("Question2b");

      var h = this.getField("Question2c");

      var i = this.getField("Question2d");

      var j = this.getField("Question2e");


      // test the field CheckBoxFirst to see if it is checked - '1' checks whether the checkboxes with 'No' Exports are checked

      // true = checked box, false = don't check the box


      if(f.isBoxChecked(0,true) || g.isBoxChecked(0,true) || h.isBoxChecked(0,true) || i.isBoxChecked(0,true)) // Check if any 'Yes' boxes are checked

          j.checkThisBox(0,true);                        // Tells the 'Yes' checkbox to be checked



      if(f.isBoxChecked(1,true) && g.isBoxChecked(1,true) && h.isBoxChecked(1,true) && i.isBoxChecked(1,true)) // Check if all 'No' boxes are checked

          j.checkThisBox(1,true);                        // Tells the 'No' checkbox to be checked




          j.checkThisBox(1,false);                          // tell box series 'Yes' to check itself