Skip to content

Commit

Permalink
allow custom validation to override inline validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuwen Qian committed Aug 16, 2016
1 parent c39dfbe commit c486445
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/strand-repeater-row/strand-repeater-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@
var elems = Array.prototype.slice.call( Polymer.dom(this).querySelectorAll('[name],[error]') )
this.errors = elems
.map(function(node) {
var validate = DataUtils.getPathValue('validate', node) || function() { return !node.error };
var name = node.getAttribute('name');
var message = custom ? record[name] : '';
var error = node.error || !!message; // validatable has set the error state, or error message is present
var message = custom ? record[name] : null;
var error = !validate.call(node, node.value) || !!message; // validatable has set the error state, or error message is present
node.error = error;

return {
Expand All @@ -103,7 +104,7 @@
};
})
.filter(DataUtils.isDef);

return this.errors.filter(function(o) { return o.error; }).length === 0;
},

Expand Down

0 comments on commit c486445

Please sign in to comment.