Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5781

AjaxRequestTarget#.focusComponent does not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 6.18.0
    • None
    • wicket
    • None
    • Windows 7 64 bit, Tomcat 7, Java 7

    Description

      I am using the following code to open a modal window and set the focus to the nameField:

      AjaxButton btn = new AjaxButton("btnNew") {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)

      { ModalWindow modalNewDefinition= new ModalWindow("mymodal"); NewDefinitionPanel p = new NewDefinitionPanel( ...); modalNewDefinition.setContent(p); modalNewDefinition.show(target); target.focusComponent(p.getNameField()); }

      }

      AjaxRequestTarget#.focusComponent works fine with Wicket 1.4 but ist has no effect with Wicket 6.18.
      WICKET AJAX DEBUG shows:

      ....
      INFO: returned focused element: [object HTMLInputElement]
      INFO: returned focused element: [object HTMLInputElement]
      INFO: focus set on inNnameField from server side
      INFO: Response processed successfully.
      INFO: Calling focus on inNnameField

      The information "INFO: focus set on inNnameField" is however missing and the focus is not set.

      Attachments

        Issue Links

          Activity

            People

              svenmeier Sven Meier
              mwalter8 Mark Walter
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: