diff --git a/app/views/invitations/edit.html.haml b/app/views/invitations/edit.html.haml index 1eac967f6..306d4fd18 100644 --- a/app/views/invitations/edit.html.haml +++ b/app/views/invitations/edit.html.haml @@ -1,3 +1,19 @@ + :javascript + $(function() { + var Validation = { + username: { + characters: /^(|[A-Za-z0-9_]{0,32})$/, + length: [6, 32] + } + }; + + $("#user_username").keypress(function(evt) { + if(!Validation.username.characters.test(this.value + String.fromCharCode($ + evt.preventDefault(); + } + }); + }); + = form_for(resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :put }) do |f| %p = f.label :username diff --git a/app/views/registrations/new.html.haml b/app/views/registrations/new.html.haml index a8f54e153..cfe6e2dc2 100644 --- a/app/views/registrations/new.html.haml +++ b/app/views/registrations/new.html.haml @@ -1,3 +1,19 @@ + :javascript + $(function() { + var Validation = { + username: { + characters: /^(|[A-Za-z0-9_]{0,32})$/, + length: [6, 32] + } + }; + + $("#user_username").keypress(function(evt) { + if(!Validation.username.characters.test(this.value + String.fromCharCode($ + evt.preventDefault(); + } + }); + }); + .span-12.prepend-6.last .floating %h3