我有一个and表单,我检查了输入的日期是否是过去的日期,然后显示带有and PopConfirm的弹出窗口,如果用户在PopConfirm中按‘是’,我想提交表单,我如何实现这一点?
下面是我的代码:
<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>发布于 2022-11-15 02:28:31
看起来像
<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>发布于 2022-11-10 10:51:27
// your component
(props) => {
const [form] = Form.useForm();
...
return (
<Form
layout='vertical'
form={form}
scrollToFirstError
onFinish={onSubmitHandler}
...
// try removing the Button properties so it does not auto submit
// in popup confirm
onConfirm={() => {
form.submit();
}https://stackoverflow.com/questions/74387690
复制相似问题