fix : form csa for onsubmit not getting triggered (#9862)

This commit is contained in:
Kiran Ashok 2024-05-24 20:34:42 +05:30 committed by GitHub
parent 1effa5e28d
commit d5f5614f4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}, []);