[pve-devel] [PATCH pve-manager v2] SafeDestroy.js: allow to submit the form with Enter key

Emmanuel Kasper e.kasper at proxmox.com
Mon Apr 4 12:01:45 CEST 2016


also set focus on the confirm field of the Destroy Window on display
---
 www/manager6/window/SafeDestroy.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/www/manager6/window/SafeDestroy.js b/www/manager6/window/SafeDestroy.js
index ec4a2f5..047c48b 100644
--- a/www/manager6/window/SafeDestroy.js
+++ b/www/manager6/window/SafeDestroy.js
@@ -12,6 +12,7 @@ Ext.define('PVE.window.SafeDestroy', {
     bodyPadding: 10,
     width: 450,
     layout: 'hbox',
+    defaultFocus: 'confirmField',
 
     viewModel: { type: 'default' },
 
@@ -53,6 +54,12 @@ Ext.define('PVE.window.SafeDestroy', {
 		    } else {
 			removeButton.disable();
 		    }
+		},
+		specialkey: function (field, event) {
+		    var removeButton = this.lookupReference('removeButton');
+		    if (!removeButton.isDisabled() && event.getKey() == event.ENTER) {
+			removeButton.fireEvent('click', removeButton, event);
+		    }
 		}
 	    },
            'button[reference=removeButton]': {
@@ -95,6 +102,7 @@ Ext.define('PVE.window.SafeDestroy', {
 		},
 		{
 		    reference: 'confirmField',
+		    itemId: 'confirmField',
 		    xtype: 'numberfield',
 		    name: 'confirm',
 		    labelWidth: 300,
-- 
2.1.4




More information about the pve-devel mailing list