Skip to content

Instantly share code, notes, and snippets.

@isaquealves
Created April 17, 2017 19:29
Show Gist options
  • Save isaquealves/83432ff0a057fa77e6117e2d0729210e to your computer and use it in GitHub Desktop.
Save isaquealves/83432ff0a057fa77e6117e2d0729210e to your computer and use it in GitHub Desktop.
var Form = {
[...]
validate: function() {
var fields = this.form.querySelectorAll('input');
var self = this;
fields.forEach(function(element) {
if (self.formFields.indexOf(element.name) !== -1) {
var allowed = self.formFields[element.name].allow;
self.invalid[element.name] = matchValues(element, allowed);
}
});
return (!nulled(this.invalid)) ? true : false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment