{"action":"opened","issue":{"url":"https://api.github.com/repos/ant-design/ant-design/issues/1264","repository_url":"https://api.github.com/repos/ant-design/ant-design","labels_url":"https://api.github.com/repos/ant-design/ant-design/issues/1264/labels{/name}","comments_url":"https://api.github.com/repos/ant-design/ant-design/issues/1264/comments","events_url":"https://api.github.com/repos/ant-design/ant-design/issues/1264/events","html_url":"https://github.com/ant-design/ant-design/issues/1264","id":143182582,"number":1264,"title":"问个表单验证的问题","user":{"login":"codering","id":2271825,"avatar_url":"https://avatars.githubusercontent.com/u/2271825?v=3","gravatar_id":"","url":"https://api.github.com/users/codering","html_url":"https://github.com/codering","followers_url":"https://api.github.com/users/codering/followers","following_url":"https://api.github.com/users/codering/following{/other_user}","gists_url":"https://api.github.com/users/codering/gists{/gist_id}","starred_url":"https://api.github.com/users/codering/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codering/subscriptions","organizations_url":"https://api.github.com/users/codering/orgs","repos_url":"https://api.github.com/users/codering/repos","events_url":"https://api.github.com/users/codering/events{/privacy}","received_events_url":"https://api.github.com/users/codering/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-24T08:17:25Z","updated_at":"2016-03-24T08:17:25Z","closed_at":null,"body":"## What you did\r\n\r\n定义了一个邮箱验证\r\n```js\r\nconst emailProps = getFieldProps('email',{\r\n       validateFirst: true,\r\n       validate: [{\r\n        rules: [\r\n          { required: true, message: '必须填写邮箱地址' },\r\n          { validator: this.emailExists }\r\n        ],\r\n        trigger: 'onBlur',\r\n      }, {\r\n        rules: [\r\n          { type: 'email', message: '请输入正确的邮箱地址' },\r\n        ],\r\n        trigger: ['onBlur','onChange'],\r\n      }]\r\n     });\r\n\r\n  emailExists(rule, value, callback) {\r\n    if (!value) {\r\n      callback();\r\n    } else {\r\n        fetch(`${api.checkEmail}?email=${value}`)\r\n        .then(response => response.json())\r\n        .then(result => {\r\n          if(result.data) {\r\n            callback([new Error('抱歉，该邮箱地址已被占用。')])\r\n          } else {\r\n            callback()\r\n          }\r\n        })\r\n    }\r\n  }\r\n```\r\n\r\n## What you would like to happen\r\n\r\n我只想要一个提示信息： 必填 or 格式错误 or 已存在\r\n\r\n## What actually happened\r\n\r\n当两个规则同时满足触发条件时，提示信息都出来了\r\n![image](https://cloud.githubusercontent.com/assets/2271825/14011705/a6cd67c4-f1db-11e5-8f99-bee7e5704e5a.png)\r\n\r\n\r\n## Online demo\r\nno\r\n\r\n## Environment Information\r\n版本是 0.12.12\r\n"}}