Reputation: 123
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
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