user7470849
user7470849

Reputation: 123

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?

Upvotes: 1

Views: 399

Answers (1)

scebotari66
scebotari66

Reputation: 3480

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."

Upvotes: 2

Related Questions