Search code examples
reactjsformsantd

How to submit the antd form onconfirmation of antd PopConfirm?


I have an antd Form on which i checked if entered date is past date then i show the Popup with antd PopConfirm and if user press 'Yes' in PopConfirm, i want to submit the form, how can i achieve this?

Below is my code :

<PopConfirm
              onConfirm={() => {
                
              }}
              cancelText={'No'}
              okText={'Yes'}
              disabled={!isPastDate}
              title={'Do you wish to continue with past date?'}
            >
              <Button type="primary" label="Save" htmlType="submit" />
            </PopConfirm>

Solution

  • look like

                            <Popconfirm
                          placement='top'
                          title='Bạn có chắc chắn muốn lưu lại thông tin đã sửa?'
                          onConfirm={() => {
                            form.submit();
                          }}
                          okText='Ok'
                          cancelText='Hủy'
                        >
                          <Button
                            type='text'
                            style={{ color: '#004EBC', padding: '0px 8px' }}
                            htmlType='submit'
                          >
                            Lưu
                          </Button>
                        </Popconfirm>