Skip to content

Instantly share code, notes, and snippets.

@blurredbits
Created January 3, 2015 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blurredbits/a003a9f6a7ffc7ac711f to your computer and use it in GitHub Desktop.
Save blurredbits/a003a9f6a7ffc7ac711f to your computer and use it in GitHub Desktop.
JS Group Week #1
validate('first_name', 'email', 'dream', 'password', 'password_confirm', function(value) {
if (this.is_empty(value)) {
return "Cannot be empty";
}
return true;
})
validate('form', function(elements) {
if (elements['first_name'].value == elements['last_name'].value) {
return "First Name and Last Name cannot be the same";
}
if (!elements['email'].is_email) {
return "Please enter a valid email";
}
if (elements['password'].value != elements['password_confirm'].value) {
return "Password & Password Confirmation must be the same";
}
if (!elements['phone_number'].is_phone_number) {
return "Phone is not valid";
}
return true;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment