LoginForm and modal dialogs

Hello,

we see strange effect when using the login form.

Here some parts of the code:

In the main window:

_loginForm= new com.vaadin.ui.LoginForm();
_loginForm.addListener(loginListener);
addComponent(_loginForm);

And the listener

    private LoginListener loginListener= new LoginListener()
    {
        @Override
            public void onLogin(LoginEvent event)
            {
                String userName= event.getLoginParameter("username");
                String password= event.getLoginParameter("password");
                if (!_mainApplication.validateUser(userName, password))
                {
                    MessageDialog messageDialog = new MessageDialog("InvalidLogin",
                            "InvalidLogin", MessageDialog.TYPE_ERROR, MessageDialog.CONTROLS_OK);
                    messageDialog.setModal(true);
                    _mainApplication.showDialog(messageDialog);
                }
                else
                {
....................
                }

            }
     }

This shows the login form, and when the login fails a modal popup is shown with the error message.
If the user now (in FF3.6) enters wrong credentials and makes ENTER to submit the login form, the
login failed window is show correctly.

But when the user now again presses ENTER, then the login event is triggered once more and we have two login failed windows open and so on…

Does this qualify for reporting as bug, or is there just not much which can be done ? (Of course we can catch this in the login handler, but…

André

So the focus is till in LoginForms input when the modal dialog becomes visible? If this is the case it is worth of a bug report. The LoginForm is quite a special creature as a Vaadin component so this might be hard to fix as you expected. If the iframe in login form does not work correctly I expect there are some other issues too with iframes and modal windows.

Even if the issue considered too expensive to fix, the ticket still documents the issue for other users.

cheers,
matti

Just making sure, that you actually explicitly focus the button inside the dialog you open after the login? If not, the focus will still be inside the iframe, thus enter key resending the form.

Yes,

the focus is still in the login form, that’s why a ENTER resends the form.

Actually we don’t handle focus in the new dialog at all, and of course we can (and will) set the focus explicitly in the dialog.

But I just did expect that a modal form takes the focus by itself. (Otherwise we could run into the same keyboard-trouble, when another component reacts on a keystroke.

André