PDA

View Full Version : form action



mayurid
8 Jul 2010, 3:21 AM
i m using the basic form login, when the user fails the success:false is returned, i want a tect message like"you cannot login " to be displayed on screen or form panel please help anyone

Condor
8 Jul 2010, 3:27 AM
Make your server respond with:

{success: false, message: 'Username unknown'}
and in the failure handler write:

failure: function(form, action){
Ext.Msg.alert('Error', action.result.message);
}

mayurid
8 Jul 2010, 3:34 AM
i dont want it in alert box,i wan to display in form continuosly

Condor
8 Jul 2010, 3:38 AM
Add a boxcomponent to your form:

{xtype: 'box', id: 'loginMessage'}
and use:

Ext.getCmp('loginMessage').el.update(action.result.message);

mayurid
8 Jul 2010, 4:06 AM
Ext.getCmp('loginMessage').el.update(action.result.message);
should i put this code in failure handler and success handler

Condor
8 Jul 2010, 4:16 AM
I assume that when the login is successful you don't want to show a message, but hide the login window and continue with your application?