Ext.form.VTypes.Password

  1. #1

    Ext.form.VTypes.Password

    The current Ext.form.VTypes.Password uses the costly upand down functions (line 4), on every call.

    In addition, on line 4, Ext.isString(field.initialPassField) will always be true.

    Going further, pwd instance is validated on line 6, then validated again on both line 7 and 10.

    Ext.apply(Ext.form.VTypes, {
        password: function (val, field) {
            if (field.initialPassField) {
                var pwd = Ext.isString(field.initialPassField) ? (field.up('container') && field.up('container').down('#' + field.initialPassField) || Ext.getCmp(field.initialPassField)) : field.initialPassField;
                if (pwd) {
                    if (pwd.processRawValue) {
                        return pwd ? (val === pwd.processRawValue(pwd.getRawValue())) : false;
                    }
                    else {
                        return pwd ? (val === pwd.getRawValue()) : false;
                    }
                }
                return false;
            }
            return true;
        }
    });
    So, i would like to suggest the following approach.
    Ext.apply(Ext.form.VTypes, {
        password: function (value, field) {
            var initialPassField = field.initialPassField;
            if (initialPassField) {
                if (Ext.isString(initialPassField)) {
                    var container = field.up('container');
    
                    initialPassField = container && container.down('#' + initialPassField) || Ext.getCmp(field.initialPassField);
    
                    field.initialPassField = initialPassField;
                }
                return initialPassField ? value === (initialPassField.processRawValue ? initialPassField.processRawValue(initialPassField.getRawValue()) : initialPassField.getRawValue()) : false;
            }
            return true;
        }
    });
    Note: on line 11, field.initialPassField is set, so on next execution it will not be necessary to "find" initialPassField again.

    Is there any chance of it be incorporated into Ext.NET?

    Thanks in advance.
    Last edited by RaphaelSaldanha; Jun 03, 2016 at 12:04 PM.
  2. #2
    Hello @Raphael!

    Thanks for the suggestion, we really appreciate it! I've just logged this issue as a feature request under #1340 github ticket!

    There is truly a possibility we will be implementing this in the future! As this is a ExtJS-specific improvement, you may also want to report this on Sencha forums. It may be troublesome for us, for example, if we apply this improvement to Ext.NET and next release ExtJS brings something incompatible with the approach taken here.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    As this is a ExtJS-specific improvement, you may also want to report this on Sencha forums. It may be troublesome for us, for example, if we apply this improvement to Ext.NET and next release ExtJS brings something incompatible with the approach taken here
    It's not an ExtJs / Sencha issue. It's a Ext.NET functionality, as you check on src\Build\Ext.Net\extnet\extnet-all-debug.js
  4. #4
    In addition, please take a look on: http://docs.sencha.com/extjs/6.0/6.0...m.field.VTypes. There is no password validation in Extjs.
    Last edited by RaphaelSaldanha; Jun 06, 2016 at 6:02 PM.
  5. #5
    Any update?
  6. #6
    Hello Raphael!

    Sorry, we didn't implement the feature yet! The github issue is open and, as soon as we implement this we will be updating here.

    Of course, if other users show their support for this feature being implemented, this is likely to be pulled ahead in the list of stuff to make&fix in Ext.NET!

    Hope you understand!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] Password fields TextField saves the password
    By ucaneto in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 29, 2014, 3:38 PM
  2. [CLOSED] [#27] Submit form with empty password confirmation
    By RCN in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Mar 18, 2013, 12:10 PM
  3. Implement a Password Meter to a Password Field
    By sudantha in forum 1.x Help
    Replies: 1
    Last Post: Jan 15, 2012, 6:59 AM
  4. [CLOSED] Validation and VTypes - how does it all work?
    By daneel in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 15, 2011, 7:20 AM
  5. [CLOSED] VTypes Question
    By bruce in forum 1.x Help
    Replies: 7
    Last Post: Feb 18, 2009, 9:48 AM

Posting Permissions