Created
January 16, 2016 19:31
-
-
Save xergioalex/df7cdf0f68b668874637 to your computer and use it in GitHub Desktop.
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
/* | |
* Validation Function | |
*/ | |
ValidationContactForm = { | |
clear: function () { | |
Validations.clear(['name', 'email', 'subject', 'message']); | |
Validations.clear(['contactFormSuccess'], true); | |
}, | |
setError: function (inputError, message) { | |
return Session.set(inputError, message); | |
}, | |
validate: function (contactProperties) { | |
this.clear(); | |
var isValid = true; | |
isValid = Validations.minLength(contactProperties.name, 3, 'nameError', 'nombre') && isValid; | |
isValid = Validations.email(contactProperties.email, 'emailError', 'email') && isValid; | |
isValid = Validations.minLength(contactProperties.subject, 3, 'subjectError', 'asunto') && isValid; | |
isValid = Validations.minLength(contactProperties.message, 5, 'messageError', 'mensaje') && isValid; | |
return isValid; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment