I am new in sencha touch framework. I am trying to create user login at first. I would like to get username and password from the form and send to api for authentication. But I could not even able to get the field values. My LoginForm view looks like this:
Ext.define('NCAPP.view.tablet.LoginForm', {
extend: 'Ext.form.Panel',
xtype:'loginForm',
id:'loginForm',
config: {
items: [
{
xtype: 'image',
src:'resources/img/netcenter_logo.png',
height: 100
},
{
xtype: 'fieldset',
title: 'NCAPP LOGIN:',
items: [
{
xtype: 'textfield',
id:'fldUsername',
name:'username',
placeHolder: 'Username'
},
{
xtype: 'textfield',
id:'fldPassword',
name:'passowrd',
placeHolder: 'Password'
}
]
},
{
xtype: 'button',
id: 'btnLogin',
text: 'Login'
}
]
}
});
and my Login Controller:
Ext.define('NCAPP.controller.tablet.LoginController', {
extend: 'Ext.app.Controller',
config: {
refs: {
loginForm:'#loginForm'
},
control: {
'#btnLogin':{
tap:'onLoginButtonTap'
}
}
},
onLoginButtonTap:function(){
var values=this.getLoginForm().getValues();
console.log(values.username); // want to see this output
Ext.ModelMgr.getModel('NCAPP.model.User').load(1,{
success: function(user){
//to do
},
failure: function(user){
console.log("failed");
}
});
},
init:function(application){
}
});
I am unsuccessful to get the value of username field. The shown error is:
Uncaught TypeError: Object function () {
return this.constructor.apply(this, arguments);
} has no method 'LoginForm'
or sometime this error:
Uncaught TypeError: Cannot call method 'getValues' of undefined
Can anybody help me please.... Thanks