Search...
onFormSubmit( )
An event that triggers when a site visitor submits a Wix Form.
Description
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.
Syntax
function onFormSubmit(event: FormSubmitEvent): void
onFormSubmit Parameters
NAME
TYPE
DESCRIPTION
event
FormSubmitEvent
The Wix Form data.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event when a Wix Form is submitted
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.34export function wixCrm_onFormSubmit(event) {5 let formName = event.formName;6}78/* Full event object:9 * {10 * "contactId": "f2cb00b5-9286-4d35-b41b-367d6fec43ce",11 * "formName": "Feedback Form",12 * "submissionTime": "2019-03-24T12:58:20.617Z",13 * "submissionData": [14 * {15 * "fieldName": "First Name",16 * "fieldValue": "John"17 * },18 * {19 * "fieldName": "Last Name",20 * "fieldValue": "Doe"21 * },22 * {23 * "fieldName": "Email",24 * "fieldValue": "john.doe@somedomain.com"25 * }26 * ],27 * "attachments": [28 * {29 * "name": "flowers.jpg",30 * "type": "IMAGE",31 * "url": "wix:image://v1/68d3a9_1de7529c444b4c9eb38401f8efe0cad2.jpg/flowers.jpg#originWidth=1970&originHeight=112"32 * },33 * {34 * "name": "SampleVideo_1280x720_10mb.mp4",35 * "type": "VIDEO",36 * "url": "wix:video://v1/80c05f_be1c421575e34915ad257571c4055ee4/SampleVideo_1280x720_10mb.mp4"37 * }38 * ]39 * }40 */