Skip to content

Instantly share code, notes, and snippets.

@xergioalex
Created January 16, 2016 19:31
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 xergioalex/df7cdf0f68b668874637 to your computer and use it in GitHub Desktop.
Save xergioalex/df7cdf0f68b668874637 to your computer and use it in GitHub Desktop.
/*
* 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