EXTJs Uncaught TypeError: this.getForm is not a function
EXTJs Uncaught TypeError: this.getForm is not a function
我为登录页面编写了一些代码(见下文),我收到以下信息
控制台错误
Uncaught TypeError: this.getForm is not a function.
有关如何解决此问题的任何帮助...
以下部分显示代码:
Ext.application({
name : 'Login',
launch : function() {
Ext.create('Ext.window.Window',{
title:'Logless',
height:200,
width:300,
padding:'10 0 10 10',
closable:false,
items:[{
xtype:'textfield',
fieldLabel:'EmpUID'
},{
xtype:'textfield',
inputType:'password',
fieldLabel:'Password'
},{
xtype:'button',
text:'Log In',
handler:this.Login,
scope:this
}],
}).show();
},
Login:function(){
//Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
this.getForm().submit({
url:'http://localhost:8085/Soumya/getFilm.action',
success:function(form,action){
Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
},
failure:function(form,action){
Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
},
})
},
});
好吧,错误消息解释得很清楚:this
对象上没有名为 getForm
的函数。
this
对象是应用程序对象(因为这是创建 window 时范围内的对象,所以设置的处理程序使用它)。 Ext.Application 对象没有名为 getForm
的函数
window 中也没有任何表单 - 您创建了一堆字段和一个按钮,但它们不是表单的一部分。
以上代码无法运行的原因有很多。
幸运的是,有一个 Sample Login Page in the Sencha documentation - 我建议你检查一下。
我为登录页面编写了一些代码(见下文),我收到以下信息 控制台错误
Uncaught TypeError: this.getForm is not a function.
有关如何解决此问题的任何帮助...
以下部分显示代码:
Ext.application({
name : 'Login',
launch : function() {
Ext.create('Ext.window.Window',{
title:'Logless',
height:200,
width:300,
padding:'10 0 10 10',
closable:false,
items:[{
xtype:'textfield',
fieldLabel:'EmpUID'
},{
xtype:'textfield',
inputType:'password',
fieldLabel:'Password'
},{
xtype:'button',
text:'Log In',
handler:this.Login,
scope:this
}],
}).show();
},
Login:function(){
//Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
this.getForm().submit({
url:'http://localhost:8085/Soumya/getFilm.action',
success:function(form,action){
Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
},
failure:function(form,action){
Ext.Msg.alert('Fiddle', 'Welcome to Sencha Fiddle!');
},
})
},
});
好吧,错误消息解释得很清楚:this
对象上没有名为 getForm
的函数。
this
对象是应用程序对象(因为这是创建 window 时范围内的对象,所以设置的处理程序使用它)。 Ext.Application 对象没有名为 getForm
window 中也没有任何表单 - 您创建了一堆字段和一个按钮,但它们不是表单的一部分。
以上代码无法运行的原因有很多。
幸运的是,有一个 Sample Login Page in the Sencha documentation - 我建议你检查一下。