vendredi 1 octobre 2021

Java Wicket: check another checkbox if checkbox checked

I have two checkbox like this:

    CheckBox checkBox1 = new CheckBox("enableCheckBox1", new PropertyModel<Boolean>(channelModel, "checkBox1"));

    CheckBox checkBox2 = new AjaxCheckBox("enableCheckbox2", new PropertyModel<Boolean>(channelModel, "checkBox2")) {

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                // check both checkBox1 and checkBox2
            }
        };

So basically, when I check checkBox2, I would like checkBox1 to be auto check as well. How do I do that?




Aucun commentaire:

Enregistrer un commentaire