mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
fix : form csa for onsubmit not getting triggered (#9862)
This commit is contained in:
parent
1effa5e28d
commit
d5f5614f4b
1 changed files with 10 additions and 13 deletions
|
|
@ -66,19 +66,16 @@ export const Form = function Form(props) {
|
|||
const mounted = useMounted();
|
||||
|
||||
useEffect(() => {
|
||||
const exposedVariables = {
|
||||
resetForm: async function () {
|
||||
resetComponent();
|
||||
},
|
||||
submitForm: async function () {
|
||||
if (isValid) {
|
||||
onEvent('onSubmit', formEvents).then(() => resetComponent());
|
||||
} else {
|
||||
fireEvent('onInvalid');
|
||||
}
|
||||
},
|
||||
};
|
||||
setExposedVariables(exposedVariables);
|
||||
setExposedVariable('resetForm', async function () {
|
||||
resetComponent();
|
||||
});
|
||||
setExposedVariable('submitForm', async function () {
|
||||
if (isValid) {
|
||||
onEvent('onSubmit', formEvents).then(() => resetComponent());
|
||||
} else {
|
||||
fireEvent('onInvalid');
|
||||
}
|
||||
});
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
|
|
|||
Loading…
Reference in a new issue