Hi,

I am trying to use AjaxCheckBox to update another checkbox model object when
this checkbox is clicked.

CheckBox b = new CheckBox("basicCreate",
                new Model<Boolean>());

AjaxCheckBox a = new AjaxCheckBox("create",
                new Model<Boolean>()) {

            private static final long serialVersionUID =
288634742710645609L;

            protected void onUpdate(AjaxRequestTarget target)
            {
                if (getModelObject()) {
                    b.setModelObject(true);
                    b.setOutputMarkupId(true);

                    target.addComponent(b);
                }
            }
        };

So when checkbox a is checked, I want checkbox b to be checked as well.
But nothing happens. Am I doing something wrong?

Thanks,
Anna

Reply via email to