1. #1
    Sencha User
    Join Date
    Jul 2008
    Posts
    22
    Vote Rating
    1
    simplessus is on a distinguished road

      0  

    Default Get keycode on keypress, keydown or keyup in textfield

    Get keycode on keypress, keydown or keyup in textfield


    Hello,

    i am trying to add a check for password-fields if caps-lock is active.

    Therefore I want to use my old function "check_capslock(e)". I don't know how to map that function to a textfield. I found various methods to do, but nothing works. I downloaded the newest version of ExtJs today.

    Here is my last try. I think "*" will not work, but I want to call that function if ANY character is pressed.

    Code:
            var map = new Ext.KeyMap(field_password.getId(), {
                key: "*",
                fn: function(e) { checkCapsLock(e); }
            });
    But even using "key: 'abcd'" does return me the keycode within the "e"-object.

    Best regards,
    Bjoern

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    why not just listen to the KEYUP event?

  3. #3
    Sencha User
    Join Date
    Jul 2008
    Posts
    22
    Vote Rating
    1
    simplessus is on a distinguished road

      0  

    Default


    How can I do this and receive the keycode ?

  4. #4
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    evt.getCharCode()

  5. #5
    Sencha User
    Join Date
    Jul 2008
    Posts
    22
    Vote Rating
    1
    simplessus is on a distinguished road

      1  

    Default


    I tried this, but firebug says "getCharCode" is not a function:

    Code:
            field_password.on('keyup',function(e,el) {
                alert(e.getCharCode());
            });

  6. #6
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      1  

    Default


    Look at the docs


    Event is the second param.

  7. #7
    Sencha User
    Join Date
    Jul 2008
    Posts
    22
    Vote Rating
    1
    simplessus is on a distinguished road

      0  

    Default


    Thanks a lot, it works!

  8. #8
    Ext JS Premium Member
    Join Date
    Apr 2008
    Location
    Oslo
    Posts
    64
    Vote Rating
    0
    mikhailt is on a distinguished road

      0  

    Default


    There is NO KEYUP event on the TextField.
    This solution does not work.

    Even with the undocumented property enableKeyEvents: true
    for TextField http://extjs.com/forum/showthread.php?p=160289

    Still the same question:
    How to listen on keypressed or keyup events on Ext.form.TextField ??

    -----------------------------------------------------------------------------------
    well, I found the solution.
    the on method must be called NOT on the Ext.form.TextField object (surprise!)
    but on the Ext.form.TextField.getEl() function (?? why is this not documented??)

    like this
    Code:
    var inputField = new Ext.form.TextField({});
    inputField .getEl().on('keyup',function(el,e) {
     alert("test");
    }

  9. #9
    Ext User
    Join Date
    Nov 2007
    Posts
    9
    Vote Rating
    0
    wan1976 is on a distinguished road

      0  

    Default


    I have tried those ways to implement the on event method, but they are all not worked. However I found this snippet code worked:

    new Ext.form.TextField({
    height : 24,
    width : 225,
    listeners : {
    specialkey : function(field, e) {
    if (e.getKey() == Ext.EventObject.ENTER) {


  10. #10
    Sencha User Alphawolf's Avatar
    Join Date
    Jul 2007
    Posts
    8
    Vote Rating
    0
    Alphawolf is on a distinguished road

      0  

    Default


    Thanks for the solution. Helped me lot.
    :|

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi