You cannot set field before registering it when set the value to dynamic form item
See original GitHub issueVersion
3.1.1
Environment
MAC 、chrome 63.0.3239.84 (64)、antd 3.1.1
Reproduction link
https://ant.design/components/form-cn/#components-form-demo-dynamic-form-item
Steps to reproduce
Dynamic form item set value,
` const formItems = keys.map((k, index) => {
return (
<FormItem
{…formItemLayoutWithOutLabel}
required={true}
key={k}
>
{getFieldDecorator( minAmount-${k} , {
rules: [{
required: true,
message: “请输入大于0的值”,
}],
})(
<InputNumber min={0.01} style={{ width: ‘10%’, marginRight: 8 }} disabled={this.state.saveDisable} placeholder=“大于0的值” step={0.01} />
)}
{ (keys.length > 1) ? (
<Button
type="danger"
disabled={keys.length === 1}
onClick={() => this.remove(k)}
>删除</Button>
) : null}
</FormItem>
);
});
Example this.props.form.setFields( { "minAmount-1" : {value : 111} } );
.
What is expected?
Set value as common fields.
What is actually happening?
You cannot set field before registering it.
When edit the row data and set the data to dynamic form item .
Issue Analytics
- State:
- Created 6 years ago
- Comments:48 (7 by maintainers)
Top Results From Across the Web
javascript - ANTD dynamic form - initial values - Stack Overflow
I am getting this error: You cannot set field before registering it. import React from "react"; import { Select, Icon, Button, Form, Input...
Read more >Form - Ant Design
High performance Form component with data scope management. Including data collection, verification, and styles.
Read more >useForm - setValue - React Hook Form
This function allows you to dynamically set the value of a registered field and have the options to validate and update the form...
Read more >How to Dynamically Modify Forms Using Form Events - Symfony
Example: on a registration form, you have a "country" field and a "state" field which should populate dynamically based on the value in...
Read more >Dynamic Forms Tips and Considerations - Salesforce Help
OData Callout Rate Limit Considerations for Salesforce Connect—OData... Set Predefined Field Values for Quick Action Fields · Fields in Party Consent Records ...
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
if your form doesn’t have the fields these you set, this error will appear!
Same problem. English please.