Search.../

onSubmitFailure( )

Runs a callback when a site visitor is not able to successfully submit a Wix Form to the server.

Note: The WixFormsV2 element is only available in Wix Studio and Editor X.

Description

If a Wix Form has not been successfully submitted by the site visitor, the received SubmissionError object contains error information about why the Wix Form could not be submitted.

Error Codes and descriptions

  • INVALID_CAPTCHA - A CAPTCHA request was not verified.
  • VALIDATION_FAILED - Form field values are invalid.
  • SERVER_UNAVAILABLE - The server is currently unavailable.
  • UNKNOWN_ERROR - An unknown error occurred.

Syntax

function onSubmitFailure(callback: OnSubmitFailureCallback): void
callback: function OnSubmitFailureCallback(error: SubmissionError): void

onSubmitFailure Parameters

NAME
TYPE
DESCRIPTION
callback

Callback for the failed form submission.

Returns

This function does not return anything.

Return Type:

void

OnSubmitFailureCallback Parameters

NAME
TYPE
DESCRIPTION
error
SubmissionError

Submission error.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Log the error when the submission has failed

Copy Code
1const submit = $w('#form').onSubmitFailure((error) => {
2 console.log('Form submission failed with an error:', error);
3});
4
5/* Resolves to:
6 *
7 * Form submission failed with an error:
8 * SUBMISSION_ERROR.VALIDATION_FAILED
9 *
10*/