changeset 1834:b3fe6f3eff1c

autofocus login form with javascript
author Johannes Berg <johannes AT sipsolutions DOT net>
date Mon, 26 Feb 2007 14:40:42 +0100
parents af0feb0e3c7b
children 0fc52d861828
files MoinMoin/userform.py wiki/htdocs/common/js/common.js
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/userform.py	Mon Feb 26 00:09:20 2007 +0100
+++ b/MoinMoin/userform.py	Mon Feb 26 14:40:42 2007 +0100
@@ -641,7 +641,7 @@
         hint = _("To create an account, see the %(userprefslink)s page. To recover a lost password, go to %(sendmypasswordlink)s.") % {
                  'userprefslink': userprefslink,
                  'sendmypasswordlink': sendmypasswordlink}
-        self._form = html.FORM(action=action)
+        self._form = html.FORM(action=action, name="loginform")
         self._table = html.TABLE(border="0")
 
         # Use the user interface language and direction
--- a/wiki/htdocs/common/js/common.js	Mon Feb 26 00:09:20 2007 +0100
+++ b/wiki/htdocs/common/js/common.js	Mon Feb 26 14:40:42 2007 +0100
@@ -188,6 +188,11 @@
     // TODO: create separate onload for each type of view and set the
     // correct function name in the html. 
     // e.g <body onlod='editor_onload()'>
+
+    // login focus
+    if (document.forms['loginform']) {
+    	document.forms['loginform'].elements['name'].focus();
+    }
     
     // Page view stuff
     update_edit_links();