From 18467a94a1ea95fd4ffe168218a59a9c07781dbc Mon Sep 17 00:00:00 2001 From: Semigradsky Date: Thu, 10 Dec 2015 09:21:53 +0300 Subject: [PATCH] Added `updateInputsWithError` to documentation. --- API.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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({