0

we run a web2print solution, that some people fill out a form to update some artwork.

The problem is some users paste in text from word or other programs, and get weird dashes, spaces etc that aren't a part of normal keyboard input.

What we want to do is restrict the input to all the "normal" keyboard keys, not the unmapped character codes. How do we do this?

Many thanks,

b

Brettski
  • 1,041
  • 2
  • 12
  • 25
  • You will be doing this on the server side as well, right? JavaScript (including jQuery) runs client-side, and the [clients](http://stackoverflow.com/questions/162159/javascript-client-side-vs-server-side-validation) [are](http://stackoverflow.com/questions/3531968/why-is-client-side-validation-a-security-risk-as-opposed-to-server-side-validatio) [not to](http://stackoverflow.com/questions/1717746/can-user-disable-javascript-at-client-side-is-it-possible) [be trusted](http://stackoverflow.com/questions/1516852/client-side-logic-or-server-side-logic). – David Thomas Mar 27 '11 at 23:24

1 Answers1

0

I would create an array or something of all keyboard keys and then remove all chars that don't match.

mattsven
  • 20,501
  • 10
  • 66
  • 102