简体   繁体   中英

ExtJS - Password / Confirm password Javascript

I successfully implemented a password validation. However, I would like

Ext.apply(Ext.form.VTypes, {

    password: function (val, field) {
        if (field.initialPassField) {
            var pwd = Ext.getCmp(field.initialPassField);
            return (val == pwd.getValue());
        }
        return true;


    },
    passwordText: 'Passwords do not match'
});

{
    xtype: 'textfield',
    name: 'newPassword',
    id: 'newPassword',
    fieldLabel: 'New Password'
},
{
    xtype: 'textfield',
    fieldLabel: 'Confirm Password',
    vtype: 'password',
    name: 'confirm_pw',
    initialPassField: 'newPassword' // id of the initial password field
}

However, when it submits, I do not want confirm password to go into the request payload because its not defined on the other end. I want to have it either merged into one with password if valid, or be deleted if valid so request only takes new password.

Any help?

Set the confirm textfield's submitValue config to false.

From the Docs: "Setting this to false will prevent the field from being submitted even when it is not disabled."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM