Soumya Mitra
Soumya Mitra

Reputation: 13

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.

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

Upvotes: 1

Views: 1275

Answers (1)

Robert Watkins
Robert Watkins

Reputation: 2206

Well, the error message is pretty explanatory: there's no function called getForm on the this object.

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

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.

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.

Upvotes: 3

Related Questions