[ 
https://issues.apache.org/jira/browse/WICKET-5781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14233146#comment-14233146
 ] 

Martin Grigorov commented on WICKET-5781:
-----------------------------------------

I don't see how Wicket 1.4 would work if the ModalWindow uses a Page. 
Because in this case the ModalWindow creates an iframe for the page content. So 
the JavaScript logic in wicket-ajax.js cannot find 'inNnameField' in the 
current (top) document.

For ModalWindow I'd suggest to use OnDomReadyHeaderItem that is contributed by 
the ModalWindow's page/panel. Because it will run in the correct context.

> AjaxRequestTarget#.focusComponent  does not work
> ------------------------------------------------
>
>                 Key: WICKET-5781
>                 URL: https://issues.apache.org/jira/browse/WICKET-5781
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.18.0
>         Environment: Windows 7 64 bit, Tomcat 7, Java 7 
>            Reporter: Mark Walter
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to