Problem with GWT with a textbox thats only allows a decimal value
Hi all,
im trying to make a validation in java (with GWT) of a textbox thats only have to allows a decimal value (xxx.yy) or a integer value (xx...), but i cant control the point decimal ('.') on the keyCode parameter:
Code Java:
public void onKeyPress(Widget sender, char keyCode, int modifiers) {
if (sender == cantidad_txt)
if (!Character.isDigit(keyCode) && (keyCode != '.') && !(keyCode == KeyboardListener.KEY_DELETE) && !(keyCode == KeyboardListener.KEY_BACKSPACE))
cantidad_txt.cancelKey();
}
}
(keyCode != '.') fails because after compile y try to write the point on the textbox and i cant write it
So... what's the problem? what im doing wrong?
PD. Srry, bad english ;)