Reject special characters in a while entering data in a text box

I have a field in a dialog which takes personal messages from the customer. The catch is, it should only allow the customer to enter alpha-numeric characters and should not allow entry of special characters. How will I be able to achieve this.

Isn’t it enough to validate the value when closing the dialog? If it’s a dialog used by a RunBase class, simply override validate() method and do the check there.