I have one textbox that means to allow no special characters. Now, I have to choose below approaches:

  1. Display inline validating message say something like "char * is not allowed" (A) or "Your input cannot contain %$*&" (B) when user input chars in black-list.
  2. Block user from enter invalid chars. Meaning that if user hit chars that are in black-list, nothing would happend.

Which of the approaches should I take?

1 Answer 1


With approach 2 (block invalid characters), the user might type something quickly and end up with a result which looks nothing like what they wanted.

Let's say a user-name field should only contain standard unaccented characters. A user could enter Juergen without a problem; but attempting to use ü instead of ue would be ignored and the user would end up with Jrgen.

Attempting to create a username like $4nta Cl4u$ would be similarly stymied: ntaClu.

This is bad: the user would have to work out what had been omitted and why and then correct it. Approach 2 should be avoided.

Method 1 (validation message) is therefore to be preferred — and this should be inline during entry rather than returned after the form is submitted.

I would prefer adding the user's invalid characters to the message as they are entered. Thus the message You cannot use ü would appear as soon as that character was typed; and in the second example it would end up as You cannot use $4[space]. (Actually using [space], not a blank character.)

In Method 1, it would be useful to make some help available as well in order that the user can find out exactly what is valid. That could appear as a tooltip, or open a separate page.


download bmml source – Wireframes created with Balsamiq Mockups

  • 3
    You need to be careful when you say which characters are allowed. "Special chars", "Invalid chars" and "Upper- and Lower-case letters without accents" are all very culture / system specific terms. If you are storing as US-ASCII then you cannot accept "ß" or "ı" which are lower case letters without diacritics (and not special or invalid to anyone who uses them regularly). Better still would be to change your backend to UTF-8 :) Commented Oct 17, 2013 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.