onFormSubmit( )


An event that triggers when a site visitor submits a Wix Form.

The onFormSubmit() event handler runs when a site visitor submits a Wix Form (see the WixForms $w element).

The received FormSubmitEvent object contains information about the Wix Form that was submitted.

Note: Backend events don't work when previewing your site.

For Wix Forms client side events, see:

  • The onWixFormSubmit() function, which sets events that fire when a site visitor submits a Wix Form yet before it is sent to the server.
  • The onWixFormSubmitted() function, which sets events that fire when a site visitor submits a Wix Form and it is successfully received by the server.
  • The onWixFormSubmittedError() function, which sets events that fire when a site visitor submits a Wix Form and it is successfully received by the server.
Method Declaration
Copy
function onFormSubmit(event: FormSubmitEvent): void;
Method Parameters
eventFormSubmitEventRequired

The Wix Form data.

An event when a Wix Form is submitted
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixCrm_onFormSubmit(event) { let formName = event.formName; } /* Full event object: * { * "contactId": "f2cb00b5-9286-4d35-b41b-367d6fec43ce", * "formName": "Feedback Form", * "submissionTime": "2019-03-24T12:58:20.617Z", * "submissionData": [ * { * "fieldName": "First Name", * "fieldValue": "John" * }, * { * "fieldName": "Last Name", * "fieldValue": "Doe" * }, * { * "fieldName": "Email", * "fieldValue": "john.doe@somedomain.com" * } * ], * "attachments": [ * { * "name": "flowers.jpg", * "type": "IMAGE", * "url": "wix:image://v1/68d3a9_1de7529c444b4c9eb38401f8efe0cad2.jpg/flowers.jpg#originWidth=1970&originHeight=112" * }, * { * "name": "SampleVideo_1280x720_10mb.mp4", * "type": "VIDEO", * "url": "wix:video://v1/80c05f_be1c421575e34915ad257571c4055ee4/SampleVideo_1280x720_10mb.mp4" * } * ] * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?