From a1304e1e5eedcc3105fa5b1b79315bd17b3b23ac Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 24 Mar 2017 14:19:11 +0100 Subject: [PATCH] fix #1317: check wizard form also on validitychange with the commit 40342aa6c4278497b9ec8c9cce8739f9b29c2e8f we introduced a validator on the guestidselector, but did not notice that the wizard checks the validity on the field change event, but the selector gets valid/invalid in an api callback(so a little later) with this patch, we now validate the field correctly with validate() and also listen on the validitychange event to catch it Signed-off-by: Dominik Csapak --- www/manager6/form/GuestIDSelector.js | 6 +++--- www/manager6/window/Wizard.js | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/www/manager6/form/GuestIDSelector.js b/www/manager6/form/GuestIDSelector.js index 0d4b85c3..71ff0dc6 100644 --- a/www/manager6/form/GuestIDSelector.js +++ b/www/manager6/form/GuestIDSelector.js @@ -21,7 +21,7 @@ Ext.define('PVE.form.GuestIDSelector', { value < me.minValue || value > me.maxValue) { // check is done by ExtJS - return; + return true; } if (me.validateExists === true && !me.exists) { @@ -65,11 +65,11 @@ Ext.define('PVE.form.GuestIDSelector', { method: 'GET', success: function(response, opts) { me.exists = false; - me.isValid(); + me.validate(); }, failure: function(response, opts) { me.exists = true; - me.isValid(); + me.validate(); } }); } diff --git a/www/manager6/window/Wizard.js b/www/manager6/window/Wizard.js index 7c10c5cb..7ae58776 100644 --- a/www/manager6/window/Wizard.js +++ b/www/manager6/window/Wizard.js @@ -229,7 +229,7 @@ Ext.define('PVE.window.Wizard', { display_header(tabs[0]); Ext.Array.each(me.query('field'), function(field) { - field.on('change', function(f) { + var validcheck = function() { var tp = me.down('#wizcontent'); var atab = tp.getActiveTab(); var valid = check_card(atab); @@ -242,7 +242,9 @@ Ext.define('PVE.window.Wizard', { } else if (ntab && !atab.onSubmit) { ntab.enable(); } - }); + }; + field.on('change', validcheck); + field.on('validitychange', validcheck); }); } }); -- 2.39.5