]> git.proxmox.com Git - pve-manager.git/commitdiff
fix #1317: check wizard form also on validitychange
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 24 Mar 2017 13:19:11 +0000 (14:19 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 27 Mar 2017 06:33:50 +0000 (08:33 +0200)
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 <d.csapak@proxmox.com>
www/manager6/form/GuestIDSelector.js
www/manager6/window/Wizard.js

index 0d4b85c3feb83fd48712da96cc8f2521d4c3196d..71ff0dc623bf10255ccc9278a987d4fde93c45a9 100644 (file)
@@ -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();
                        }
                    });
                }
index 7c10c5cbe7b5a8005a616e2a1e3b07e2d2aab7ea..7ae58776f34b15b1df77545137c220fe44800ea3 100644 (file)
@@ -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);
        });
     }
 });