I new in sencha touch and I make a simple login form wichh accepts username and password from a user. When I click submit, The fields value of form will viewed in javascript alert in JSON format. I create my form in views application. Here’s my code:
var formPanel = Ext.define('GS.view.Login', {
extend: 'Ext.form.Panel',
xtype: 'loginform',
requires: [
'Ext.form.FieldSet'],
config: {
title: 'Login',
iconCls: 'home',
url: 'authenticate_page.php',
items: [{
xtype: 'fieldset',
title: 'Login',
items: [{
xtype: 'textfield',
name: 'txt_username',
label: 'Username'
}, {
xtype: 'passwordfield',
name: 'txt_password',
label: 'Password'
}]
}, {
xtype: 'button',
text: 'Allow me in',
ui: 'confirm',
handler: function () {
var values = this.getValues();
alert(values);
}
}]
}
});
I tried some ways but it isn’t work. Please help.
In your button’s
handlerThe
thisis referring to your button and of course your button does not bear with any form values.To get the form values, do this:
Checkout the documentation for Ext.form.Panel. It has enough examples to guide you through.