TextChangeEvent for TextField inside modal window

I’m currently running into very stupid problem and stuck on it. I have a simple layout inside a modal window containing a TextField (or PasswordField) with text change listener that suppose to enable or disable a button. Immediate mode is set for text field. When I type in text field, event listener is not hit for some reason. It is hit only in case if text field looses focus or any other similar event occurs. I’m using same code in many places in my application - everything works perfectly everywhere, but not inside this modal window… Vaadin 6.8.9.


      confirmNewPassword = new PasswordField();
      confirmNewPassword.setImmediate( true );
      confirmNewPassword.addListener( TextChangeEvent.class, 
         this, "onPasswordChange" );

      ...
      
      public void onPasswordChange(TextChangeEvent event)
      {
          final String value = (String) newPassword.getValue();
          final String confirm = event.getText();
          boolean saveAllowed = (null != value && 
             value.length() >= 6 && value.equals( confirm ));
          okButton.setEnabled( saveAllowed );
      }

Can someone help on this?

Hi Sergey,

try adding this line after setImmediate(true)

confirmNewPassword.setTextChangeEventMode( TextChangeEventMode.EAGER ); HTH,

Javi