I have a Sencha Touch 2 MVC application with a form in a view. I try to get these values ββfrom the controller without success.
How can I do that? I am posting my view / controller code for this.
View:
Ext.define('MyApp.view.LoginForm', { extend: 'Ext.form.Panel', config: { fullscreen: true, items: [ { xtype: 'fieldset', title: 'Login', id: 'loginform', items: [ { xtype: 'emailfield', name: 'email', label: 'Email' }, { xtype: 'passwordfield', name: 'password', label: 'Password' } ] }, { xtype: 'button', width: '50%', text: 'Login', ui: 'confirm', id: 'btnSubmitLogin' }, { xtype: 'toolbar', docked: 'top', title: 'MyApp Mobile' } ] } });
And the controller:
Ext.define("MyApp.controller.LoginForm", { extend: "Ext.app.Controller", config: { refs: { btnSubmitLogin: "#btnSubmitLogin" }, control: { btnSubmitLogin: { tap: "onSubmitLogin" } } }, onSubmitLogin: function () { console.log("onSubmitLogin"); var values = app.views.LoginForm.loginform.getValues(); TryLogin(values['email'], values['password']); }, launch: function () { this.callParent(); console.log("LoginForm launch"); }, init: function () { this.callParent(); console.log("LoginForm init"); } });
Code will grow to
console.log("onSubmitLogin");
And then stop.
At startup, I use this:
var LoginForm = Ext.create("MyApp.view.LoginForm"); Ext.Viewport.add(LoginForm);
So how can I get the values?
thanks