sencha touch は初めてです。フォームを作成し、そのフォームの詳細をデータベースに送信したいと考えています。このために、次のコードを記述します。
Ext.define("Form.view.Main",{
extend: "Ext.form.Panel",
requires:['Ext.Button',
'Ext.Spacer',
'Ext.field.Password'
],
config: {
fullscreen: true,
id:'form',
items: [
{
xtype:'fieldset',
items:[
{
xtype: 'textfield',
name : 'name',
label: 'Name'
},
{
xtype: 'emailfield',
name : 'email',
label: 'Email',
placeHolder: 'Email address',
useClearIcon: true
},
{
xtype: 'passwordfield',
name : 'password',
label: 'Password',
allowBlank:'false'
}
]
},
{
centered:'true',
xtype:'button',
id:'submitBtn',
text:'Submit',
ui:'confirm',
width:100,
listeners: {
tap : function(thisTxt,eventObj){
var form = Ext.getCmp('form');
var values = thisTxt.getValues();
alert(values.name);
Ext.Ajax.request({
url:'http://localhost/sencha2011/form/insert.php',
params:values,
success : function(response){
var text = response.responseText;
Ext.Msg.alert('Success', text);
},
failure : function(response){
Ext.Msg.alert('Error','Error while submitting the form');
console.log(response.responseText);
}
});
}
}
}
]
}
});
このアプリを実行しようとすると、正常に実行 (デバッグ) されます。ブラウザでアプリケーションを開くと、コンソール ウィンドウに "Uncaught TypeError: Cannot call method 'getValues' of undefined" というエラーが表示され、フォームのみが表示されます。送信ボタンをクリックしても何も起こりません。これを解決するのに役立つ人はいますか? 前もって感謝します...