5 Replies Latest reply on Feb 8, 2018 9:23 AM by dennisg96201989

    Checkbox checked, other checkboxes become both checked & disabled

    dennisg96201989 Level 1

      Hi,

       

      I have three checkboxes in my form named checkbox1, checkbox2 and checkbox3.

       

      I wish the following to happen:

       

      If checkbox1 is checked, then:

      • checkbox2 and checkbox3 also becomes checked

      • but at the same time checkbox 2 and checkbox3 also become disabled (by disabled

      I mean not checkable, not clickable).

       

      I have this script that does half the job, it disables checkbox 2 and checkbox3 when checkbox1 is checked:

       

      // set readonly property based on the value of this field compared to "Off";

      this.getField("checkbox2").readonly = (event.target.value != "Off");

      this.getField("checkbox3").readonly = (event.target.value != "Off");

       

      Though, as described above, I want checkbox2 and checkbox3 to become both checked and disabled at the same time.

       

      How would this script look like?

       

      Thanks for your help!

       

      Greatings,

      Dennis (Javascript beginner)