Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
reiniergs committed Jul 10, 2015
1 parent b86cca7 commit 8691866
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,17 +365,18 @@ Formsy.Form = React.createClass({
// Validate the form by going through all child input components
// and check their state
validateForm: function () {
var allIsValid = true;
var allIsValid;
var inputs = this.inputs;
var inputKeys = Object.keys(inputs);

// We need a callback as we are validating all inputs again. This will
// run when the last component has set its state
var onValidationComplete = function () {
inputKeys.forEach(function (name) {
allIsValid = inputKeys.every(function (name) {
if (!inputs[name].state._isValid) {
allIsValid = false;
return false;
}
return true;
}.bind(this));

this.setState({
Expand Down

0 comments on commit 8691866

Please sign in to comment.