diff --git a/app/views/invitations/edit.html.haml b/app/views/invitations/edit.html.haml
index 306d4fd18..a894947be 100644
--- a/app/views/invitations/edit.html.haml
+++ b/app/views/invitations/edit.html.haml
@@ -8,7 +8,7 @@
};
$("#user_username").keypress(function(evt) {
- if(!Validation.username.characters.test(this.value + String.fromCharCode($
+ if(!Validation.username.characters.test(this.value + String.fromCharCode(evt.charCode)) {
evt.preventDefault();
}
});
diff --git a/app/views/registrations/new.html.haml b/app/views/registrations/new.html.haml
index cfe6e2dc2..918acd57b 100644
--- a/app/views/registrations/new.html.haml
+++ b/app/views/registrations/new.html.haml
@@ -8,7 +8,7 @@
};
$("#user_username").keypress(function(evt) {
- if(!Validation.username.characters.test(this.value + String.fromCharCode($
+ if(!Validation.username.characters.test(this.value + String.fromCharCode(evt.charCode)) {
evt.preventDefault();
}
});