diff --git a/API.md b/API.md index 667e468..3021dd3 100644 --- a/API.md +++ b/API.md @@ -13,6 +13,7 @@ - [onChange()](#onchange) - [reset()](#resetform) - [getModel()](#getmodel) + - [updateInputsWithError()](#updateinputswitherror) - [preventExternalInvalidation](#preventexternalinvalidation) - [Formsy.Mixin](#formsymixin) - [name](#name) @@ -180,6 +181,26 @@ var MyForm = React.createClass({ ``` Manually get values from all registered components. Keys are name of input and value is of course the value. +#### updateInputsWithError(errors) +```jsx +var MyForm = React.createClass({ + someFunction: function () { + this.refs.form.updateInputsWithError({ + email: 'This email is taken', + 'field[10]': 'Some error!' + }); + }, + render: function () { + return ( + + ... + + ); + } +}); +``` +Manually invalidate the form by taking an object that maps to inputs. This is useful for server side validation. You can also use a third parameter to the [`onSubmit`](#onsubmitdata-resetform-invalidateform), [`onValidSubmit`](#onvalidsubmitmodel-resetform-invalidateform) or [`onInvalidSubmit`](#oninvalidsubmitmodel-resetform-invalidateform). + #### preventExternalInvalidation ```jsx var MyForm = React.createClass({