Automation that will trigger a popup message when a user submits a form?

Hey guys,
Im trying to set an automation that will trigger a popup message when a user submits a form. I created a lightbox for the pop up message and used the code below but i get an error. Can anyone please help me out with the right code for this automation?

Code used:

import wixWindow from ‘wix-window’; //

/**

  • Autocomplete function declaration, do not delete
  • @param {import(‘./schema.js’).Payload} options
    */
    export const invoke = async ({payload}) => {
    $w.onReady(function () {
    $w(‘#contactform’).onWixFormSubmit((event) => {
    wixWindow.openLightbox(‘page1’);
    });
    });
    return {}; // The function must return an empty object, do not delete
    };

Thanks in advance!

Is it a Wix Form a custom Form connected to a dataset?

No it’s not. its a pre made form.

Will i be able to link the submit button to a lightbox if i create a form with CMS?