[pve-devel] r5494 - pve-manager/pve2/www/manager/window

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Feb 9 06:55:56 CET 2011


Author: dietmar
Date: 2011-02-09 06:55:55 +0100 (Wed, 09 Feb 2011)
New Revision: 5494

Modified:
   pve-manager/pve2/www/manager/window/LoginWindow.js
Log:
better focus handling


Modified: pve-manager/pve2/www/manager/window/LoginWindow.js
===================================================================
--- pve-manager/pve2/www/manager/window/LoginWindow.js	2011-02-08 12:14:02 UTC (rev 5493)
+++ pve-manager/pve2/www/manager/window/LoginWindow.js	2011-02-09 05:55:55 UTC (rev 5494)
@@ -13,7 +13,10 @@
 	    form.submit({
 		failure: function(f, resp){
 		    self.el.unmask();
-		    Ext.MessageBox.alert('Failure', "Login failed. Please try again");
+		    Ext.MessageBox.alert('Failure', "Login failed. Please try again", function() {
+			var uf = form.findField('username');
+			uf.focus(true);
+		    });
 		},
 		success: function(f, resp){
 		    self.el.unmask();
@@ -49,14 +52,7 @@
 
 		defaults: {
 		    anchor: '-5',
-		    allowBlank: false,
-		    listeners: {
-			specialkey: function(field, e) {
-			    if (e.getKey() === e.ENTER) {
-				self.onLogon();
-			    }
-			}
-		    }
+		    allowBlank: false
 		},
 
 		items: [
@@ -68,6 +64,17 @@
 			listeners: {
 			    render: function(f) {
 				f.focus(true, 500);
+			    },
+			    specialkey: function(f, e) {
+				var form = f.findParentByType("form").getForm();
+				if (e.getKey() === e.ENTER) {
+				    var pf = form.findField('password');
+				    if (pf.getValue()) {
+					self.onLogon();
+				    } else {
+					pf.focus(false);
+				    }
+				}
 			    }
 			}
 		    },
@@ -76,7 +83,14 @@
 			inputType: 'password',
 			fieldLabel: 'Password', 
 			name: 'password',
-			blankText:"Enter your password"
+			blankText:"Enter your password",
+			listeners: {
+			    specialkey: function(field, e) {
+				if (e.getKey() === e.ENTER) {
+				    self.onLogon();
+				}
+			    }
+			}
 		    }
 		],
 		buttons: [




More information about the pve-devel mailing list