I have a antd form that consists of input and checkboxes.
antd : 4.16.0 react : 17.0.2
After using,
this.formRef.current.resetFields(); the input fields are getting reset but not the checkboxes.
Sample Code:
<Form layout="vertical" hideRequiredMark initialValues={{ sunH: [ moment("00:00", "HH:mm"), moment("00:00", "HH:mm"), ], monH: [ moment("00:00", "HH:mm"), moment("00:00", "HH:mm"), ], }} ref={this.props.formRef} > <Row gutter={16}> <Col span={12}> <Form.Item name="pName" label="Name" rules={[ { required: true, message: "Please enter Name", }, ]} > <Input placeholder="Enter name" /> </Form.Item> <Form.Item name="Mon" label="" valuePropName="checked"> <Text>Mon</Text> </Form.Item> </Col> </Row> </Form> the form takes in a onCancel props, so onCancel,
this.formRef.current.resetFields(); log of this.formRef.current:
