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

Filed under:
|

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:

http://code.google.com/p/chromium/issues/detail?id=1383&can=1&q=window.focus%20type%3aBug&colspec=ID%20Stars%20Pri%20Area%20Type%20Status%20Summary%20Modified%20Owner

so I need to do this in other way

© Stack Overflow or respective owner

Related posts about java

Related posts about wicket