Form.resetFields and onChange event
See original GitHub issueWhat problem does this feature solve?
This feature would help alot while building dynamic forms (fields showing/hiding depends on previous picks). Currently its hard to fully reset form when form contains children components with own state edited by select onChange.
What does the proposed API look like?
'this.props.form.resetFields( {} , {triggerOnChange:true} )` or made onChange trigger as default.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React Ant Design form.resetFields() doesn't call onChange ...
Since AntD Form is uncontrolled, there is no way to trigger onChange event by calling resetFields , setFieldsValues .
Read more >Form - Ant Design
High performance Form component with data scope management. ... It has event onChange or an event which name is equal to the value...
Read more >Solved: Combobox OnChange (Edit form) needs to reset field...
Solved: I have a combobox that has an OnChange value that auto-populates a text box and filters the item list for a second...
Read more >useForm - resetField - Simple React forms validation
resetField : (name: string, options?: Record<string, boolean | any>) => void. Reset an individual field state. Props. After invoke this function.
Read more >API Reference - Formik
<Formik> is a component that helps you with building forms. It uses a render props pattern made ... General input change event handler....
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
It’s weird.
You can trigger customized event:
@benjycui 我现在也碰到这种情况: 组件1 联动控制 组件2。 我在组件1加载完成后用setFields预填了内容,我期望setFields可以触发其onChange事件,进而影响到组件2,事实上并不如此。
或许我们可以在api上加上触发onChange的可选项?