Form dynamic setFields Error
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
https://3x.ant.design/components/form-cn/#components-form-demo-dynamic-form-item
Steps to reproduce
{getFieldDecorator(names[${k}], {
validateTrigger: [‘onChange’, ‘onBlur’],
rules: [
{
required: true,
whitespace: true,
message: “Please input passenger’s name or delete this field.”,
},
],
this.props.form.setFields({ names:{ value:[1,1], errors:[new Error(‘test’)] } });
对 names 使用 setFields 会报错 Warning: You cannot set a form field before rendering a field associated with the value.
What is expected?
setFields 可以对 数组形式的装饰字段使用
What is actually happening?
对 names 使用 setFields 会报错 Warning: You cannot set a form field before rendering a field associated with the value.
| Environment | Info |
|---|---|
| antd | 3.26.12 |
| React | 16.6 |
| System | mac |
| Browser | chrome |
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Ant Design. How to set form field error message dynamically?
the syntax is updated in v4. new syntax is: setFields. | Set fields status | (fields: FieldData[]) => void. example : form.
Read more >Form - Ant Design
High performance Form component with data scope management. Including data collection, verification, and styles.
Read more >Ant Design. How To Set Form Field Error Message Dynamically
A form consists of one or more form fields whose type includes input, textarea, checkbox, radio, Ask questionsForm dynamic setFields Error. [x] I...
Read more >Form.Item set dynamic error - Code Examples & Solutions For ...
formChange.setFields([ { name: 'inputFieldName', errors: ['Mi primer error Zelene', 'Mi segunda posible caía Jazmín'] } ]);
Read more >useForm - setValue - React Hook Form
This function allows you to dynamically set the value of a registered field ... Whether to compute if your input is valid or...
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 Free
Top 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
#8806
not work yet codepen.io