Learn More... SQLsnap Logo. SQLsnap Screenshot. Buy Now or Learn More!

How to process the Enter key with ExtJS

May 5th, 2011

To use the Enter key on your ExtJS forms, you need to setup a listener on your input fields.

For example:

                    {
                        xtype: 'textfield',
                        fieldLabel:'Password',
                        inputType:'password',
                        listeners:{
                            scope:this,
                            specialkey: function(f,e){
                                if(e.getKey()==e.ENTER){
                                    Ext.Msg.alert('Keys','You pressed the Enter key');
                                }
                            }
                        }

                    }

So in the example above, there is a specialkey listener on the password field. If you press Enter while the password field has focus, the specialkey event will fire, your listener will get control and you can then handle the field and/or the form the same way clicking a button would.

Scott


Posted in: Extjs 3.
Subscribe: RSS 2.0 feed.

  • derek

    helpful.

  • Andre

    Tks Man!

  • Ks_kvl

    thanks

blog comments powered by Disqus
  • « Older Entries
  • Newer Entries »