Update main.js
This commit is contained in:
parent
b86cca70b3
commit
8691866c0d
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in New Issue