From c486445e37d5da85c71979bb1f49631f72813c3b Mon Sep 17 00:00:00 2001 From: Shuwen Qian Date: Tue, 9 Aug 2016 14:31:14 -0500 Subject: [PATCH] allow custom validation to override inline validation --- src/strand-repeater-row/strand-repeater-row.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/strand-repeater-row/strand-repeater-row.js b/src/strand-repeater-row/strand-repeater-row.js index eb620fa0..7cb5e7f0 100644 --- a/src/strand-repeater-row/strand-repeater-row.js +++ b/src/strand-repeater-row/strand-repeater-row.js @@ -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 { @@ -103,7 +104,7 @@ }; }) .filter(DataUtils.isDef); - + return this.errors.filter(function(o) { return o.error; }).length === 0; },