简体   繁体   English

ExtJS-密码/确认密码Javascript

[英]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. 将确认文本字段的submitValue配置设置为false。

From the Docs: "Setting this to false will prevent the field from being submitted even when it is not disabled." 在文档中:“将其设置为false会阻止即使未禁用该字段也无法提交。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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