0

I tried to put focus on a textfield in a pop-up window which opens up when i click on a particular link.I used wicket behavior for this.But the fact is it is working only in FF and not in IE.I am at my wit's end.Please help. My code is: in .java file:

username.add(new FocusOnLoadBehavior());//username is the textfield and it is in a form.

The FocusOnLoadBehavior:

public class FocusOnLoadBehavior extends AbstractBehavior {
    private static final long serialVersionUID = 1L;
    private Component component;

    public void bind(Component component) {
        this.component = component;
        component.setOutputMarkupId(true);
    }

    public void renderHead(IHeaderResponse iHeaderResponse) {
        super.renderHead(iHeaderResponse);
        iHeaderResponse.renderOnLoadJavascript("document.getElementById('"
                + component.getMarkupId() + "').focus();");
    }
}
LCtoM
  • 1

1 Answers1

0

This occured due to the fact that i was trying on a panel. Instead if it was done on a page,it would have worked.

LCtoM
  • 1