I wonder if this is a good idea to restrict input to numbers only (and related symbols like +-.e and so on) when you need user to input number? Seems like it's clear solution, but may be user will be confused with not seeing symbols that he is typing?


If you want to avoid confusion, you could display an error message below the entry box (or someplace else) that they tried to add an illegal character. This is preferable to letting them enter illegal characters, which would lead to more problems and them wasting effort on having to reenter.


Your idea is a good one: in situations where you have a hard requirement on an input, make it impossible for the user to make a mistake.

I've used a combination approach to good effect. If the user presses a key for a disallowed character:

  1. Prevent the character from being added
  2. Display a message, clearly tied to the field ("Oops, please enter numbers only." - adamsoh's answer is a great example)
  3. Optional: Make the field "shake." I find this gets the user's attention, tells them they did something the system doesn't like, but is playful enough that it doesn't annoy the user (this may change if it becomes more ubiquitous, however).

P.S. One caveat: if you're going to change the user's input as they type, make sure the functionality works flawlessly. Hijacking the cursor can get super annoying if implemented poorly (e.g. inappropriately switching focus to the next field/preventing the user from fully clearing out the input/pressing backspace resulting in two backspaces).


I have something similar which I implemented for phone entry. I added an event tracking to monitor the bounce rate for this particular field. So far the usability has been pretty ok. I suppose you could extend this to include other characters like +, - or floating points.


download bmml source – Wireframes created with Balsamiq Mockups

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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