From f5038cdc3cf95d6f3107153a4e6422d289ad8a80 Mon Sep 17 00:00:00 2001 From: Mark Schmale Date: Mon, 13 Dec 2010 11:47:57 +0100 Subject: [PATCH] replaced charCode by keyCode. On every browser, keyCode is filled with the Unicode Character Code when used in keypress. charCode is only supported in some browsers. --- public/javascripts/validation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/javascripts/validation.js b/public/javascripts/validation.js index d456bce49..24c8fdf2e 100644 --- a/public/javascripts/validation.js +++ b/public/javascripts/validation.js @@ -11,8 +11,8 @@ var Validation = { }, events: { usernameKeypress: function(evt) { - if(evt.charCode === 0) { return; } - if(!Validation.rules.username.characters.test(this.value + String.fromCharCode(evt.charCode))) { + if(evt.keyCode === 0) { return; } + if(!Validation.rules.username.characters.test(this.value + String.fromCharCode(evt.keyCode))) { evt.preventDefault(); } }