Created
January 3, 2015 04:10
-
-
Save blurredbits/a003a9f6a7ffc7ac711f to your computer and use it in GitHub Desktop.
JS Group Week #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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