How to trigger a JavaScript function after Webflow Memberstack signup completion? Answered

Post author
Max Joles

I want to run a Javascript function when a Webflow Memberstack Sign Up form has been submitted? Any idea how I could do this? is there a method or callback I can tap into?

Comments

3 comments

  • Comment author
    Raquel Lopez

    Hi Max,
    Memberstsck doesn’t have an event to listen to forms. If you’re using Webflow I think you can use a normal listener to listen for the submit

    If you were to manually handle the form you could send the data to memberstack by using the memberstack signup method and after await the response you can trigger the callback

    0
  • Comment author
    Max Joles

    Can you explain the second part? What do you mean by “manually handling the form”?

    0
  • Comment author
    Raquel Lopez

    Manually handling means not using the Memberstack parameters (data--ms-form=...) but instead using the form as a plain form to send the data. You can use a submit listener, and handle the data of the form using signupMemberEmailPassword provided by Memberstack library.In simple terms, it would look to something like this

    signupForm.addEventListener("submit", async (e) => {
      e.preventDefault();
    
      // handle submit
      await memberstack.signupMemberEmailPassword({
        // formData
      })
    
      yourCallback()
    });
    

    https://developers.memberstack.com/docs/dom-front-end-package#signing-up-a-member-using-email-and-password

    0

Please sign in to leave a comment.