2 Replies Latest reply on Oct 23, 2015 10:30 AM by robertwire

    Checkbox that controls Checkboxes

    robertwire

      I have 6 checkboxes total on a form. Four of them are used to show what the forms ship terms should be (Will Call, Prepaid, Prepaid & Add and Collect) and two of them are used to show the forms delivery terms should be (FOB-Mill and FOB-MFA). The user should only be able to select one of the ship terms and shouldn't need access to the delivery terms if the code works correctly. If the user checks another ship term it should uncheck their previous selections. Lastly I'm trying to code it so that if Will Call or Collect is checked it will check FOB-Mill. If they select Prepaid or Prepaid & Add it will check FOB-MFA. If they select another ship term it should remove and add the corresponding checks. Can this be done with Radio Buttons or is there a code I can use to achieve this? Any help would be very much appreciated as I've tried everything to get this work with no luck. Thanks.

        • 1. Re: Checkbox that controls Checkboxes
          MatLac Level 1

          everything can be done with everything, lol.  You will use combination of the property .isBoxChecked(0) and the method .checkThisBox(0, true) to achieve what you want in an "if statement"

           

          if (this.getField("myBox1").isBoxChecked(0) == true){     //if my box is checked

               this.getField("myBox2").checkThisBox(0, true)  // check my other box

          }

          else{

               this.getField("myBox2").checkThisBox(0, false)  // uncheck my other box

          }

           

          that's a simple example.

          • 2. Re: Checkbox that controls Checkboxes
            robertwire Level 1

            Excellent. This works perfectly and it was a lot more simple than I was attempting to do. Thank you so much for helping me out with this.