How to unselect checkbox in chrome browser
Posted
by
hudi
on Stack Overflow
See other posts from Stack Overflow
or by hudi
Published on 2012-09-17T12:04:15Z
Indexed on
2012/09/19
9:38 UTC
Read the original article
Hit count: 195
in my wicket application I have 3 checkbox in form:
add(new CheckBox("1").setOutputMarkupId(true));
add(new CheckBox("2").setOutputMarkupId(true));
add(new CheckBox("3").setOutputMarkupId(true));
form also contain behavior which unselect checboxes
add(new AjaxEventBehavior("onclick") {
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target) {
List<Component> components = new ArrayList<Component>();
if (target.getLastFocusedElementId() != null) {
if (target.getLastFocusedElementId().equals("1")) {
components.add(get("2"));
components.add(get("3"));
} else if (target.getLastFocusedElementId().equals("2")) {
components.add(get("1"));
} else if (target.getLastFocusedElementId().equals("3")) {
components.add(get("1"));
}
for (Component component : components) {
component.setDefaultModelObject(null);
target.add(component);
}
}
}
});
this works good on mozilla browser but in chrome this doesnt work. How I can improve to work this on chrome too ?
UPDATE
problem is in:
target.getLastFocusedElementId()
in mozilla this return what I want but in chrome it always return null but I dont know wh
UPDATE 2
google chrome has bug in focus element:
so I need to do this in other way
© Stack Overflow or respective owner