APIs & Integrations

JSiv
Member

Why setting onFormSubmit prevents calling onFormSubmitted?

SOLVE

Setting the onFormSubmit callback, prevents

 

1) Redirection, if configured in Hubspot

2) Following events, like onFormSubmitted

 

I tried multiple times, I tried returning true, etc.

 

onFormSubmit: (form: any) => {
setFormSubmitted(true);
setFormData(
...
)
}
0 Upvotes
1 Accepted solution
JSiv
Solution
Member

Why setting onFormSubmit prevents calling onFormSubmitted?

SOLVE

Issue was that the setState for formSubmitted actually made React to unmount the form. So the rest of the callback were erroring I guess and execution stopped.

This could be used to prevent the redirection set in the form config itself, but idk which side effects it would have

View solution in original post

0 Upvotes
1 Reply 1
JSiv
Solution
Member

Why setting onFormSubmit prevents calling onFormSubmitted?

SOLVE

Issue was that the setState for formSubmitted actually made React to unmount the form. So the rest of the callback were erroring I guess and execution stopped.

This could be used to prevent the redirection set in the form config itself, but idk which side effects it would have

0 Upvotes