Hi,

I want to allow only digits to be passed to text box.

is this correct for all browsers:
    private KeyPressHandler keyPressHandler = new KeyPressHandler() {
        @Override
        public void onKeyPress(KeyPressEvent keypressevent) {
            switch(keypressevent.getNativeEvent().getKeyCode()){
            case KeyCodes.KEY_LEFT:
            case KeyCodes.KEY_DOWN:
            case KeyCodes.KEY_RIGHT:
            case KeyCodes.KEY_UP:
            case KeyCodes.KEY_BACKSPACE:
            case KeyCodes.KEY_DELETE:
                return;
        }
        if (!Character.isDigit(keypressevent.getCharCode())) {
            ((TextBoxBase) keypressevent.getSource()).cancelKey();
        }
        }
    };

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to