Send custom action form, then webflow form explicitly

Hello,

How can we explicitly prevent webflow action to send a form by default, so that we can perform a custom action on that form, then only execute the default webflow action ?

My problem at the moment is that I can’t figure out how to run the webflow action again after having unbind the webflow form handling… :thinking:

Share only link here
Simplified website here

Current JavaScript

var Webflow = Webflow || [];
Webflow.push(function() {

  // 💀 unbind webflow form handling
  $(document).off("submit");

  // 🥶 on submit
  $("#form").submit(function(event) {
    event.preventDefault();
    customAction();
    webflowAction();
  }); // end submit

  // 🍓 custom action
  function customAction() {
    alert("custom action doing nothing 🍓");
  } // end custom()

  // 🥦 webflow action
  function webflowAction() {
    alert("webflow action sending form 🥦");
    $(document).on("submit");
    return true;
  } // end custom()
}); // end webflow.push()
1 Like

Hi Anthony,

Did you find a solution for this? Im trying to do exactly the same thing but having trouble getting the form to submit to Webflow after the custom action?

Why don’t you just call the function you want to perform? If you need the form to be submitted why call preventDefault? :man_shrugging: