简体   繁体   English

EXTJs 未捕获类型错误:this.getForm 不是 function

[英]EXTJs Uncaught TypeError: this.getForm is not a function

I wrote some code (see below) for a login page I am receiving the following error in the Console我为登录页面编写了一些代码(见下文)我在控制台中收到以下错误

Uncaught TypeError: this.getForm is not a function.未捕获的类型错误:this.getForm 不是 function。

Any Help on how to resolve this...有关如何解决此问题的任何帮助...

Below part shows the code:下面的部分显示了代码:

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!');
              },
          })
      },
    });

Well, the error message is pretty explanatory: there's no function called getForm on the this object.好吧,错误消息非常解释:在this object 上没有名为getForm的 function。

The this object is the application object (because that's the object in scope when the window was created, so the handler that's set up uses that). The this object is the application object (because that's the object in scope when the window was created, so the handler that's set up uses that). And Ext.Application objects don't have a function called getForm并且 Ext.Application 对象没有名为 getForm 的getForm

Nor is there any form in the window - you've created a bunch of fields, and a button, but they aren't part of a form. window 中也没有任何表单 - 您创建了一堆字段和一个按钮,但它们不是表单的一部分。

So there's all sorts of reasons why the code above won't work.所以上面的代码不起作用的原因有很多。

Fortunately, there is a Sample Login Page in the Sencha documentation - I suggest you examine that.幸运的是, Sencha 文档中有一个示例登录页面——我建议您检查一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM