Grab this code from stackoverflow, should do what you want
http://stackoverflow.com/questions/2865647/solution-for-numeric-text-field-in-gwt
On Monday, January 7, 2013 4:55:44 PM UTC+2, membersound wrote:
>
> Hi,
>
> I have a textbox where I want to user to only enter digits. Moreover I
> want to prevent him entering other characters. This is what I tried but it
> does not work:
>
> @UiHandler("textbox")
> void onInputsKeyPress(KeyPressEvent event) {
> if (!Character.isDigit(event.getCharCode())) {
> ((IntegerBox) event.getSource()).cancelKey();
> }
> }
>
> Any hints?
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/EnUl7quza6MJ.
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.