Results 1 to 3 of 3

Thread: How to detect enter key in formPanel

  1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    14
    Vote Rating
    0
      0  

    Default Answered: How to detect enter key in formPanel

    Could anyone tell me how to detect when enter key is pressed in a formPanel. Looks like a simple task, but I have no clue.

    Please help.

  2. Should be able to add a listener for 'specialkey' and the second argument is an EventObject. You should be able to check to see if the key is e.ENTER.

    http://docs.sencha.com/ext-js/4-0/#!...ent-specialkey

    There is an example how to do just that.

    If you wanted it on the Ext.form.Panel iteself you can do something like this:

    Code:
    form.mon(form.el, {
        keypress : function(e, t, opts) {
            if (e.getKey() == e.ENTER) {....}
        }
    });
    You can use keyup or keydown if you don't want keypress.

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,380
    Answers
    3997
    Vote Rating
    1525
      0  

    Default

    Should be able to add a listener for 'specialkey' and the second argument is an EventObject. You should be able to check to see if the key is e.ENTER.

    http://docs.sencha.com/ext-js/4-0/#!...ent-specialkey

    There is an example how to do just that.

    If you wanted it on the Ext.form.Panel iteself you can do something like this:

    Code:
    form.mon(form.el, {
        keypress : function(e, t, opts) {
            if (e.getKey() == e.ENTER) {....}
        }
    });
    You can use keyup or keydown if you don't want keypress.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    May 2011
    Posts
    14
    Vote Rating
    0
      0  

    Thumbs up

    PM
    mitchellsimoens,

    Thank you very much for your quick reply. Your suggestion does just what I need.

    Cheers!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •