Simple login form with SenchaTouch

Just immerse yourself in SenchaTouch, which seems very promising.

I am building my first application, a simple source for validating the login form http://pastebin.com/8Zddr9cj

I am looking for a way to do the following:

  • Display the message "nice" when the username / password is incorrect. May be red to replace "Please enter your credentials"; I do not know how to access this property.

  • If the login is successfully completed, close the form and download the application (possibly another js file).

Pretty simple, but I'm new to this,

+3
source share
1 answer

1) Fieldset setInstructions, . , id , , .

...
items: [
    {
        xtype: 'fieldset',
        id: 'fieldset',
        title: 'Login',
        instructions: 'Please enter your credentials',
        defaults: {
            required: true,
            labelAlign: 'left',
            labelWidth: '40%'
        },
        items: [
        {
            xtype: 'emailfield',
            name : 'email',
            label: 'Email',
            placeHolder: 'your@email.com',
            useClearIcon: true
        }, {
            xtype: 'passwordfield',
            name : 'password',
            label: 'Password',
            useClearIcon: false
        }]
    }
],
...

//wherever you want to update the instructions
var fieldset = Ext.getCmp('fieldset');
fieldset.setInstructions('My new instructions!');

2) :

//create a panel, which is full screen, and will contain your form, and another item
//which you want to show at some point
var wrapper = new Ext.Panel({
    fullscreen: true,
    layout: 'card',

    //my two items
    items: [
        form,
        {
            xtype: 'panel',
            html: 'my second panel, which is not visible on render.'
        }
    ]
});

//change the active card/item, when you need to
wrapper.setActiveItem(1); //starts at 0

, , ( ).

+1

All Articles