Skip to content

Commit

Permalink
Fix showing multiple error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Semigradsky committed Jul 9, 2015
1 parent 9e5723c commit 89759fe
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,13 @@ Formsy.Form = React.createClass({
return [validationErrors[requiredResults.success[0]]] || null;
}

if (!isValid) {
return [validationError];
if (validationResults.failed.length) {
return validationResults.failed.map(function(failed) {
return validationErrors[failed] ? validationErrors[failed] : validationError;
}).filter(function(x, pos, arr) {
// Remove duplicates
return arr.indexOf(x) === pos;
});
}

}.call(this))
Expand Down

0 comments on commit 89759fe

Please sign in to comment.