question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValidateFields can not perceive dynamic modification rules

See original GitHub issue

Environment(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:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
iiitmaheshcommented, Feb 17, 2017

Same issue for me also …!

0reactions
lock[bot]commented, May 8, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found