javascript validations for username
This commit is contained in:
parent
75caecc6a3
commit
b1c1175c67
2 changed files with 32 additions and 0 deletions
|
|
@ -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|
|
= form_for(resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :put }) do |f|
|
||||||
%p
|
%p
|
||||||
= f.label :username
|
= f.label :username
|
||||||
|
|
|
||||||
|
|
@ -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
|
.span-12.prepend-6.last
|
||||||
.floating
|
.floating
|
||||||
%h3
|
%h3
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue