From 4d2bdfd93dc3039f48c91ddfa47d0dd2cdccc6f8 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 9 Nov 2016 10:16:36 +0800 Subject: [PATCH] docs: update docs for form --- components/form/index.en-US.md | 7 +++---- components/form/index.zh-CN.md | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index ca254eb32c..e16e7e02ee 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -75,11 +75,10 @@ If the form has been decorated by `Form.create` then it has `this.props.form` pr ### this.props.form.getFieldDecorator(id, options) -After wrapped by `getFieldDecorator`, `value` `onChange` props will be added to form controls,the flow of form data will be handled by Form which will cause: +After wrapped by `getFieldDecorator`, `value`(or other property defined by `valuePropName`) `onChange`(or other property defined by `trigger`) props will be added to form controls,the flow of form data will be handled by Form which will cause: - -1. You don't need to use `onChange` and should not add `value` `onChange` to controls. (There are warnings after `antd@2.0`) -2. You can not set default value via `defaultValue` prop, you should use `initialValue` in `getFieldDecorator` instead. +1. You don't need to use `onChange` to collect data, but you still can listen to `onChange`(and so on) events. +2. You can not set value of form control via `value` `defaultValue` prop, and you should set default value with `initialValue` in `getFieldDecorator` instead. 3. You don't need to call `setState` manully, please use `this.props.form.setFieldsValue` to change value programmatically. #### Special attention diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index e3a45b8986..a0004c8df6 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -77,10 +77,10 @@ CustomizedForm = Form.create({})(CustomizedForm); ### this.props.form.getFieldDecorator(id, options) -经过 `getFieldDecorator` 包装的控件,表单控件会自动添加 `value` `onChange` 等属性,数据同步将被 Form 接管,这会导致以下结果: +经过 `getFieldDecorator` 包装的控件,表单控件会自动添加 `value`(或 `valuePropName` 指定的其他属性) `onChange`(或 `trigger` 指定的其他属性),数据同步将被 Form 接管,这会导致以下结果: -1. 你不再需要用 `onChange` 来做同步,也不应该给控件单独添加 `value` `onChange` 等属性。(2.0 后会在控制台进行警告) -2. 你不能用控件的 `defaultValue` 属性来设置默认值,请用 `getFieldDecorator` 里的 `initialValue`。 +1. 你不再需要用 `onChange` 来做同步,但还是可以继续监听 `onChange` 等事件。 +2. 你不能用控件的 `value` `defaultValue` 等属性来设置表单域的值,默认值可以用 `getFieldDecorator` 里的 `initialValue`。 3. 你不需要用 `setState`,可以使用 `this.props.form.setFieldsValue` 来动态改变表单值。 #### 特别注意