Form validation in a dialog box using submit button OR Enter key

Form validation in a dialog box using submit button OR Enter key

Hi,
I am quite newbie with javascript and jquery programming.
I am trying to accept both way to validate a a form displayed in a dialog  (authentication box) :
- clicking on submit button
- press enter in the form (normal behavior of web browsers with HTML forms)
First, I just tried something like the exemple in the tutorial but enter key does not submit the form.
Then I tried that :
function dialog_auth_submit() {
    //$('#dialog form').submit();
    $('*').css('cursor','progress');
    ....
};
$('#dialog_auth').dialog({
    autoOpen: false,
    buttons: {
        'Login': dialog_auth_submit()
    },
    ...
};
$('#dialog_auth').keypress(function(e) {
    if (e.which == 13) {
        dialog_auth_submit();
    }
});
Now my form can be validated with Enter key but clicking on the submit button does not. The javascript console does not report any error.
Any clue ?
Thanks.
Fred