diff --git a/app/views/invitations/edit.html.haml b/app/views/invitations/edit.html.haml index 1eac967f66fdd7f344a865b524edfba1853a0583..306d4fd1825cf3504f7237500d65e10b8dbfbc6c 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 a8f54e153bb34607eb631d82f6eb12ccd4fa2676..cfe6e2dc2fc32527d7524f11053bd95783c0c7e6 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