Merge pull request #160 from reiniergs/master

Update main.js
This commit is contained in:
Dmitry Semigradsky 2015-07-10 20:42:33 +03:00
commit c84d5e2a45
1 changed files with 3 additions and 5 deletions

View File

@ -365,17 +365,15 @@ 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) {
if (!inputs[name].state._isValid) {
allIsValid = false;
}
allIsValid = inputKeys.every(function (name) {
return inputs[name].state._isValid;
}.bind(this));
this.setState({