BTW, whilw checking the checkbox the AJAX Debug window says:
Info: Set focus on required
That's all.
2008/8/8 Kai Mütz <[EMAIL PROTECTED]>
> Hi,
>
> I have 2 form components in a form. A checkbox and a dropdownchoice. The
> dropdownchoice should depend on the checkbox, as it is enabled if the
> checkbox is checked and disabled if the checkbox is not checked.
>
> Thus I have added a AjaxFormComponentUpdatingBehavior:
>
> final CheckBox required = new CheckBox("required", new
> PropertyModel(project, "required"));
> add(required);
> final DropDownChoice officer = new DropDownChoice("officer", new
> PropertyModel(project, "officer"), users, true);
> add(officer);
> officer.setOutputMarkupId(true);
> officer.setEnabled(project.isRequired());
> required.add(new AjaxFormComponentUpdatingBehavior("onchange") {
> protected void onUpdate(final AjaxRequestTarget target) {
> officer.setEnabled((Boolean) required.getModelObject());
> if (!officer.isEnabled()) {
> officer.setModelObject(null);
> }
> target.addComponent(officer);
> }
> });
>
>
> This works fine withe Firefox. With IE7 (and IE6) the dropdownchoice is not
> updated until clicking on the it. Example:
>
> - Checkbox is unchecked and dropdownchoice is disabled by default
> - Check the checkbox -> nothing happens, dropdownchoice is still disabled
> (in IE)
> - Clicking on dropdownchoice -> dropdownchoice is enabled
> - Uncheck the checkbox -> nothing happens, dropdownchoice is still enabled
> (in IE)
> - Clicking on dropdownchoice -> dropdownchoice is disabled
>
>
> Can anybody help?
>
> Cheers, Kai
>
>