Hi,
Attached patch shifts focus to the password field if 'enter' was pressed inside the username field.
I would commit this without asking if I weren't concerned about wether I placed the new 'login form methods' block in the right place, and using the proper reference vars etc.
Thomas, is this OK?
Robin
--- program/js/app.js (revision 521) +++ program/js/app.js (working copy) @@ -274,6 +274,8 @@ case 'login': var input_user = rcube_find_object('_user'); var input_pass = rcube_find_object('_pass');
if (input_user)
input_user.onkeypress = function(e){ return rcmail.login_user_keypress(e); };
if (input_user && input_user.value=='')
input_user.focus();
else if (input_pass)
@@ -1627,6 +1629,34 @@
return null;
};
/*********************************************************/
/********* login form methods *********/
/*********************************************************/
this.init_login_form_events = function(obj)
{
var handler = function(e){ return ref.login_user_keypress(e,this); };
if (obj.addEventListener)
obj.addEventListener(bw.safari ? 'keydown' : 'keypress', handler, false);
else
obj.onkeydown = handler;
};
// handler for keyboard events on the _user field
this.login_user_keypress = function(e)
{
var key = document.all ? event.keyCode : document.getElementById ? e.keyCode : 0;
// enter
if ((key==13) && (document.form._pass))
{
document.form._pass.focus();
return false;
}
};
/*********************************************************/