Does MktoForms2 have an onFailure? Is there a way for my codebase to log if a form submit fails | Community
Skip to main content
Steve_Chang
New Participant
January 15, 2020
Question

Does MktoForms2 have an onFailure? Is there a way for my codebase to log if a form submit fails

  • January 15, 2020
  • 1 reply
  • 14747 views

For MktoForms2, there is an .onSuccess(callback)

but there doesn't seem to be a .onFailure(callback)

I've read through the api many times, I can't seem to figure out a way to find out if the form submit has failed.

Is there a way to do this? How do other people ensure they are aware when a form submission fails?

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
New Participant
January 15, 2020
Steve_Chang
New Participant
January 24, 2020

Hi @Sanford Whiteman‌, thanks so much for the blog post and the expertise.

I'm trying to implement it now. It occurred to me... is there any way to test my implementation? How would I be able to make it fail on purpose?

Question 2: "Remember, onSubmitError is for network and server errors, like a TCP/IP timeout/reset or a down server returning 404 or 500." - So, does it catch things like 'invalidInputMsg' or 'formSubmitFailedMsg'?

So far, I am unable to catch it when I intentionally try to fail by sending an incomplete form:

When I get that error, my callback isn't getting called in FormsPlus.onSubmitError(myCallback). I can see that FormsPlus is correctly defined when I console.log(FormsPlus), so it's just not being called. 

So my question is, can those errors be caught using this method (in which case I implemented it wrong). Or can they not be caught?

In addition, are there any additional thoughts you have around how to best ensure the form submits go through properly?

TL;DR:

Question 1: How do I get my request to fail on purpose to test the implementation?

Question 2: is onSubmitError suppose to be able to catch invalidInputMsg

Thanks, I appreciate it. 

SanfordWhiteman
New Participant
January 25, 2020

How are you generating invalid input - and how is this input invalid on the server side but would not be caught by onValidate on the client?