Change the example code from the TextBox Javadoc API like this:

    tb.addKeyboardListener(new KeyboardListenerAdapter() {
      public void onKeyPress(Widget sender, char keyCode, int modifiers) {
        if (Character.isDigit(keyCode)) return;
        if ((keyCode == '.') // Add all your allowed characters here
            || (keyCode == '$')
            || (keyCode == '#')) return;
          // TextBox.cancelKey() suppresses the current keyboard event.
          ((TextBox)sender).cancelKey();
        }
      }
    });

this allows digits and '.', '$' and '#'

Fred

On Fri, Sep 12, 2008 at 12:42, jagadesh <[EMAIL PROTECTED]> wrote:

>
> Hi Guys,
>
>
> How Can We Disable Special Characters in the textfield in gwt. iam
> using Keyboard Listener .
> i used isDigit() and isCharacter() , but it is coing to accept some
> characters like " . # $ ( & ".
> how can  i disable these characters too.
>
> Please Sort Me Out Form This Issue.
>
>
> Thank u.
>
> jagadesh
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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