I created a Wix form (based on the template Emergency Contact form in the Waiver category) and want to perform some logic in the backend when a user submits the form. According to the documentation ( https://www.wix.com/velo/reference/wix-crm-backend/events/onformsubmit ) " The onFormSubmit() event handler runs when a site visitor submits a Wix Form". So I created the events.js file in the backend and placed the following code in it:
export function wixCrm_onFormSubmit ( event ) {
let formName = event . formName ;
console . log ( event );
console . log ( "form name is " + formName );
//if the form submitted is a block user request, process the request
if ( formName == “My Form” ){
//first we must validate the request data
for ( let i = 0 ; i < event . data . length ; i ++) {
console . log ( event . data [ i ]);
}
}
}
I published the site and submitted the form. I confirmed that the data was added to the submission table but nothing showed in the developer logs when the form was submitted (the console.log code was not fired).
The submission table shows in the dashboard under Communications>Forms & Submissions.
So what am I missing? Why did my onFormSubmit event code not fire?
Please help.