diff --git a/API.md b/API.md
index d537df0b..fbb6abc0 100644
--- a/API.md
+++ b/API.md
@@ -15,6 +15,7 @@
- [getModel()](#getmodel)
- [updateInputsWithError()](#updateinputswitherrorerrors)
- [preventExternalInvalidation](#preventexternalinvalidation)
+ - [validateOnMount](#validateOnMount)
- [Formsy.Mixin](#formsymixin)
- [name](#name)
- [value](#value)
@@ -220,6 +221,12 @@ var MyForm = React.createClass({
```
With the `preventExternalInvalidation` the input will not be invalidated though it has an error.
+#### validateOnMount
+```html
+
+```
+`validateOnMount` indicates that whether Formsy.Form validates all its inputs immediately after the initial rendering occurs (e.g componentDidMount). By default it's `true` e.g validate on componentDidMount
+
### Formsy.Mixin
#### name
diff --git a/src/main.js b/src/main.js
index c2eaa43d..9f3d2e04 100644
--- a/src/main.js
+++ b/src/main.js
@@ -42,6 +42,7 @@ Formsy.Form = React.createClass({
onInvalid: function () {},
onChange: function () {},
validationErrors: null,
+ validateOnMount: true, // avoid break change
preventExternalInvalidation: false
};
},
@@ -70,7 +71,9 @@ Formsy.Form = React.createClass({
},
componentDidMount: function () {
- this.validateForm();
+ if (this.props.validateOnMount) {
+ this.validateForm();
+ }
},
componentWillUpdate: function () {
@@ -408,7 +411,9 @@ Formsy.Form = React.createClass({
this.inputs.push(component);
}
- this.validate(component);
+ if (this.props.validateOnMount) {
+ this.validate(component);
+ }
},
// Method put on each input component to unregister