I'm trying to read data input into form fields using the following code:
var formeg = Ext.define('Layouts.view.Form', {
extend: 'Ext.Panel',
xtype: 'form',
requires: [
'Ext.form.FieldSet',
'Ext.field.Password'
],
config: {
title: 'Form',
iconCls: 'user',
control: {
'button[action=button_get]': {
tap: 'response_get'
}
},
items: [
{
xtype: 'toolbar',
title: 'Form Example'
},
{
xtype: 'fieldset',
title: 'A Form Example ...',
items: [
{
xtype: 'textfield',
label: 'Name:',
name: 'name',
value: 'Dr Fraiser Crane'
},
{
xtype: 'textfield',
label: 'Email:',
name: 'email',
value: 'fcrane@kacl.org'
},
{
xtype: 'passwordfield',
label: 'Password:',
name: 'password',
value: 'imlistening'
},
{
items: [
{
xtype: 'toolbar',
items: [
{
xtype: 'button',
text: 'Set Data',
handler: function(){
Ext.Msg.alert('Set');
}
},
{
xtype: 'button',
text: 'Get Data',
action: 'button_get',
/*handler: function(){
// Ext.Msg.alert('Get: ' + values);
}*/
},
{
xtype: 'button',
text: 'Clear Data',
handler: function(){
Ext.Msg.alert('Cancel');
}
}
]
}
]
}//buttons
]
}//fieldset
]
},//config
response_get: function(event){
var values = formeg.getValues();
Ext.Msg.alert('Get button responding');
console.log('Testing GET button response: ' + values);
}
});
All I'm trying to accomplish is using my response_get
function to print the data in the form fields but I get the following error:
Uncaught TypeError: Object function () {
return this.constructor.apply(this, arguments);
} has no method 'getValues'
And the answer is .....
Extend Ext.form.Panel instead of Ext.Panel