diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index ef94f43652..02a04744fe 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -99,6 +99,40 @@ If the form has been decorated by `Form.create` then it has `this.props.form` pr | options.force | Should validate validated field again when `validateTrigger` is been triggered again | boolean | false | | options.scroll | Config scroll behavior of `validateFieldsAndScroll`, more: [dom-scroll-into-view's config](https://github.com/yiminghe/dom-scroll-into-view#function-parameter) | Object | {} | +#### Callback arguments example of validateFields + +- `errors`: + + ```js + { + "userName": { + "errors": [ + { + "message": "Please input your username!", + "field": "userName" + } + ] + }, + "password": { + "errors": [ + { + "message": "Please input your Password!", + "field": "password" + } + ] + } + } + ``` + +- `values`: + + ```js + { + "userName": "username", + "password": "password", + } + ``` + ### Form.createFormField To mark the returned fields data in `mapPropsToFields`, [demo](#components-form-demo-global-state). diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index a477daec8d..356cb7b0a9 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -100,6 +100,41 @@ this.form // => The instance of CustomizedForm | options.force | 对已经校验过的表单域,在 validateTrigger 再次被触发时是否再次校验 | boolean | false | | options.scroll | 定义 validateFieldsAndScroll 的滚动行为,详细配置见 [dom-scroll-into-view config](https://github.com/yiminghe/dom-scroll-into-view#function-parameter) | Object | {} | +#### validateFields 的 callback 参数示例 + +- `errors`: + + ```js + { + "userName": { + "errors": [ + { + "message": "Please input your username!", + "field": "userName" + } + ] + }, + "password": { + "errors": [ + { + "message": "Please input your Password!", + "field": "password" + } + ] + } + } + ``` + +- `values`: + + ```js + { + "userName": "username", + "password": "password", + } + ``` + + ### Form.createFormField 用于标记 `mapPropsToFields` 返回的表单域数据,[例子](#components-form-demo-global-state)。