ExtJs4.2 知识点

知识点1:修改密码类

参考:点击这里

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: '两次输入的密码不一致!'

});



Ext.onReady(function () {

        var formWidget = Ext.widget({

        xtype: 'form',

        layout: 'form',

        renderTo: 'myKeyDiv',

        id: 'titleSetForm',

        frame: true,

        title: '修改密码',

        bodyPadding: '5 5 0',

        width: 350,

        fieldDefaults: {

            msgTarget: 'side',

            labelWidth: 75

        },

        defaultType: 'textfield',

        items: [{

            fieldLabel: '当前密码',

            inputType: 'password',    //密码框属性设置

            name: 'keyold',

            allowBlank: false,

            blankText: '密码不能为空',

            regex: /^[\s\S]{0,20}$/,

            regexText: '密码长度不能超过20个字符'

        }, {

            id: 'keynew1',

            fieldLabel: '新密码',

            inputType: 'password',    //密码框属性设置

            name: 'keynew1',

            allowBlank: false,

            blankText: '密码不能为空',

            regex: /^[\s\S]{0,20}$/,

            regexText: '密码长度不能超过20个字符'

        }, {

            fieldLabel: '确认密码',

            inputType: 'password',    //密码框属性设置

            initialPassField: 'keynew1',

            id: 'keynew2',

            name: 'keynew2',

            vtype: 'password',

            allowBlank: false,

            blankText: '密码不能为空',

            regex: /^[\s\S]{0,20}$/,

            regexText: '密码长度不能超过20个字符'

        }]

           });

});

如图:

QQ截图20140414171527

你可能感兴趣的:(extjs4)