1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    118
    Vote Rating
    0
    Kutu is on a distinguished road

      0  

    Default [CLOSED] KeyListener.componentKeyPress() does not work in FF

    [CLOSED] KeyListener.componentKeyPress() does not work in FF


    Platform: FF v2, OSX 10.5, GWT 1.5 + GXT 1.0B4

    Use the FormPanelPage example and modified the NumberField code as follow:

    final NumberField number = new NumberField();
    number.setFieldLabel("Age");
    number.setEmptyText("Enter your age");
    number.setAllowBlank(false);
    number.setAllowDecimals(false);
    number.setAllowNegative(false);
    number.setFormat(NumberFormat.getFormat("00"));
    number.setMaxLength(2);
    number.setMinLength(2);
    number.addKeyListener(new KeyListener() {

    @Override
    public void componentKeyPress(final ComponentEvent event) {
    number.validate();
    }

    });
    panel.add(number);

    - Steps:
    1. Enter 2 digits: won't work
    2. Enter 3 digits: work

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    What does not work? Also, you can call setAutoValidate(true) to validate on each key press.

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    118
    Vote Rating
    0
    Kutu is on a distinguished road

      0  

    Default


    I may have overlooked "setAutoValidate" method.

    But the componentKeyPress doesn't behave normally. If you plug in my code to the FormPanelPage example, and try to enter "12" (2 digits) in the NumberField (Age) @ Firefox, the warning message will stay unless you put "123" (3 digits).

    I specifically limit the valid range to 2 digits (min-max).

  4. #4
    Ext User
    Join Date
    Apr 2008
    Posts
    118
    Vote Rating
    0
    Kutu is on a distinguished road

      0  

    Default


    Quote Originally Posted by darrellmeyer View Post
    What does not work? Also, you can call setAutoValidate(true) to validate on each key press.
    Does setAutoValidate(true) invoke the Validator as well?

  5. #5
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    yes it does - but the isvalid bug is still there....http://extjs.com/forum/showthread.php?t=38565

  6. #6
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    This code works fine in FF:

    PHP Code:
        final NumberField number = new NumberField();
        
    number.setFieldLabel("Age");
        
    number.setEmptyText("Enter your age");
        
    number.setAllowBlank(false);
        
    number.setAllowDecimals(false);
        
    number.setAllowNegative(false);
        
    number.setAutoValidate(true);
        
    number.setFormat(NumberFormat.getFormat("00"));
        
    number.setMaxLength(2);
        
    number.setMinLength(2);
        
    panel.add(number); 

Thread Participants: 2