PDA

View Full Version : login form submit failed in Sencha Touch 2



glom1029
16 Jul 2012, 11:05 PM
i make a login formpanel like this,
(in view)



loginForm = this.getParent();
loginForm.submit({
params: this.getParent().getValues(),


success: function(form, result) {
alert('success');
},


failure: function(form, action) {
alert('fail');
}
});

Ext.define('prototype.view.login', {
extend: 'Ext.form.Panel',


config: {
id: 'login',
url: 'http://localhost:8000/signin/',
method: 'POST',
standardSubmit: false,
items: [
{
xtype: 'textfield',
name: 'username',
id: 'username',
placeHolder: 'Username'
},
{
xtype: 'passwordfield',
name: 'password',
id: 'password',
placeHolder: 'Password'
},
{
xtype: 'checkboxfield',
label: 'Remember me',
labelWidth: '70%',
name: 'remember_me',
id: 'remember_me',
checked: true
},
{
xtype: 'button',
itemId: 'loginBtn',
ui: 'action',
text: 'Login',


listeners: {
tap: onLoginBtnTap
}
}
]
},


});


and create it from app.js.

when i set standardSubmit to false, after submitting it fails, but i don't know why and how to fix it.
when i set standardSubmit to true, it success! but it direct to the url i set above and show the json response. i don't want to get to that page...

i'm a beginner in Sencha Touch.
i've tried hard google any solution but in vain.
i must thinking the wrong way...

can anyone help me?

thanks.

sword-it
17 Jul 2012, 2:34 AM
duplicate of http://www.sencha.com/forum/showthread.php?230809-login-form-submit-failed-in-Sencha-Touch-2