PDA

View Full Version : Login form



Dinduks
26 Nov 2010, 2:32 AM
Hello,
I have made a login form and it returns a success when submitted.
But I don't how to "switch" between the login page and the main page of my app.
Any idea?
In advance, thanks.

tomalex0
26 Nov 2010, 2:43 AM
First thing you have to do is to make a Main Panel(m) and keep login panel(L) as its item, and create another panel(A).
After successful login , setActive card (A)



m.setActiveItem(A);


Just give a try.

Dinduks
26 Nov 2010, 3:10 AM
I'll try that. Thanks. :)

Dinduks
26 Nov 2010, 4:21 AM
I did:


var mainPanel = new Ext.Panel({
layout: 'card',
items: [formLogin]
});

While:


var formLogin = {
url: 'login.php',
scroll: 'vertical',

items: [
{
xtype: 'fieldset',
title: 'Login',
},
{
xtype: 'emailfield',
name : 'email',
id : "email",
label: 'Email'
},
{
xtype: 'passwordfield',
name : 'password',
id:"password",
label: 'Mot de passe'
}
],

listeners : {
submit : function(form, result){
alert(result.msg);
},
exception : function(form, result){
alert("Error :x");
}
},

dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',
items: [
{xtype: 'spacer'},
{
text: 'Réinitialiser',
handler: function() {
form.reset();
}
},
{
text: 'Envoyer',
ui: 'confirm',
handler: function() {
form.submit({
waitMsg : {message:'Envoi...', cls : 'envoi-bg'},
});
}
}
]
}]

};


It works, but the design isn't the same as if I show formLogin alone.

But it doesn't work if I do this:


items: [formLogin, suiviPanel]


Can you please show me how to use that card thing?

Thanks.

mitchellsimoens
26 Nov 2010, 6:44 AM
"have to"? Not really. You could destroy the login form and then build whatever you want on success.