ValidateFields can not perceive dynamic modification rules
See original GitHub issueEnvironment(required)
- antd version: 2.7.1
- OS and its version: osx 10.12.3
- Browser and its version: 56.0.2924.87 (64-bit)
What did you do? Please provide steps to re-produce your problem.
The code is as follows:
{getFieldDecorator('receiverEmail', {
rules: [
{ required: getFieldValue('billingFlag') !== '0', message: '必填项' },
],
})(
<Input />
)}
handleSubmit(e) {
e.preventDefault();
this.props.form.validateFields((err, values) => {
console.log(err);
}
}
What do you expected?
when getFieldValue(‘billingFlag’) !== ‘0’ changes from false to true,the validateFields should know receicerEmail empty
What happen?
when getFieldValue(‘billingFlag’) !== ‘0’ changes from false to true, the validateFields did not find receiverEmail empty
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Antd Custom validator and validateFields are not working ...
I'm working on a form ( Ant Design <Form> ) where I want a custom validation of phone number (as it depends on...
Read more >Form onFieldsChange is executing while validating ... - GitHub
I am simply triggering a modal with data from the form. But before that, I just execute the validateFields method to check whether...
Read more >Form - Ant Design
Use Item initialValue only with dynamic field usage. Priority follows the rules: Form initialValues is the first priority; Field initialValue is secondary *....
Read more >Flutter: how to validate fields dynamically created - Medium
In this case, isFormValid (a StreamedType<bool> ) is set to true, a true event is sent to stream triggering the StreamBuilder to rebuild...
Read more >Validations, default values, and unmapped fields
To skip validateField for a back-end table, a consumer can call DataEntity. ... Is called by the form engine when a field is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue for me also …!
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.