Block Key Press
General
Tired of customers using characters that could possibly render your forms useless? This script prevents a user from entering certain special characters in designated form fields.
Notes
- Created by: Corneliu Lucian 'Kor' Rusu
- E-mail: corneliulucian[at]gmail[dot]com
- Posted: August 17, 2007
Source Code
Paste this source code into the designated areas.
External file
Paste this code into an external JavaScript file named: blockKeyPress.js
Head
Paste this code into the HEAD section of your HTML document.
Body
Paste this code into the BODY section of your HTML document


Leave a Response
(7 comments)Hi![br /][br /]it's great script and it save me a lot of time. thanks[br /][br /]to allow space,underscore and dash sign (_ and - )[br /]I just replace the line of regular exp to[br /][br /]'special':/[^0-9a-zA-Z.\-_\s]+$/,[br /][br /]and it's still working fine :)[br /][br /]regards,[br /]qammar[br /]http://www.pkshops.com
Not of the problem, Matt. It only blocks those items mentioned.
Great script!! How do I get it from limiting spaces? It works to good and won't allow spaces between words or numbers.[br /][br /]Matt
Exellent prevent all SQL atacks injections.
It is very useful.[br /]Thanks