From 93ec71ea58256eef44354fc643384e9c2502bf26 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 21 Mar 2017 15:21:40 +0800 Subject: [PATCH] fix whitespace required, close #5418 --- components/form/demo/register.md | 2 +- components/form/index.en-US.md | 1 + components/form/index.zh-CN.md | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/form/demo/register.md b/components/form/demo/register.md index 51666495bc..3cce0d3eb4 100644 --- a/components/form/demo/register.md +++ b/components/form/demo/register.md @@ -164,7 +164,7 @@ class RegistrationForm extends React.Component { hasFeedback > {getFieldDecorator('nickname', { - rules: [{ required: true, message: 'Please input your nickname!' }], + rules: [{ required: true, message: 'Please input your nickname!', whitespace: true }], })( )} diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index 04c0601079..5e443a4f68 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -133,6 +133,7 @@ Property | Description | Type | Default Value message | validation error message | string | - type | built-in validation type, [available options](https://github.com/yiminghe/async-validator#type) | string | 'string' required | indicates whether field is required | boolean | `false` +whitespace | treat required fields that only contain whitespace as errors | boolean | `false` len | validate an exact length of a field | number | - min | validate a min length of a field | number | - max | validate a max length of a field | number | - diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index aa6bb1419c..c28929757a 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -134,6 +134,7 @@ CustomizedForm = Form.create({})(CustomizedForm); message | 校验文案 | string | - type | 内建校验类型,[可选项](https://github.com/yiminghe/async-validator#type) | string | 'string' required | 是否必选 | boolean | `false` +whitespace | 必选时,空格是否会被视为错误 | boolean | `false` len | 字段长度 | number | - min | 最小长度 | number | - max | 最大长度 | number | -