ExtJS: Login with 'Remember me' functionality

后端 未结 3 1142
遇见更好的自我
遇见更好的自我 2021-02-02 02:13

I\'m trying to create a simple login window with the very common \'Remember me\' functionality. The login validation is done AJAX style, thus the browser won\'t remember my inpu

3条回答
  •  无人共我
    2021-02-02 02:38

    Use with Ajax funcionality:

    {
        xtype: 'form',
        autoEl: {
            //normal post for false submit
            tag: 'form', 
            action: "#", 
            method: 'post'
        },
        items: [
            {
                xtype: 'textfield',
                name: 'username',
                fieldLabel: 'Username',
                listeners: {
                    afterrender:function(cmp){
                        cmp.inputEl.set({
                            autocomplete:'on'
                        });
                    }
                }
            },
            {
                xtype: 'textfield',
                name: 'password',
                inputType: 'password', 
                fieldLabel: 'Password',
                listeners: {
                    afterrender:function(cmp){
                        cmp.inputEl.set({
                            autocomplete:'on'
                        });
                    },
                }
            },
            {
                xtype: 'button',
                text: 'Login',
                handler: function() {
                    Ext.Ajax.request(); //login ajax request
                    Ext.get('falsesubmit').dom.click(); //false submit
                },
            },
            {
                //button with submit input for false submit
                xtype: 'button',
                hidden:true,
                listeners: {
                    afterrender: function() {
                        this.el.createChild({tag: 'input', type: 'submit', id: 'falsesubmit'});
                    }
                }
            }
        ]
    }
    

提交回复
热议问题