Disabling Form Submission?

Is it possible to disable a form’s email submission? I have a site with three forms on it and would like to prevent one of them from sending emails through the Form settings, as it’s a zip code submission that redirects to an external booking page. Is this possible somehow?

1 Like

I think if you change the action to post the form elsewhere, it won’t be sent to Webflow. Could you try that out?

@samliew what’s the best way to have it post elsewhere? It’s using a custom redirect on submission right now but I can’t figure out how to not have it submit emails through Webflow.

This is the script I’m using to disable form submissions while under development, perhaps you could insert your custom code in the submit function (leave the return false at the end to stop webflow default)

<script>
Webflow.push(function() {
  // Disable submitting form fields during development
  $('form').submit(function() {
    alert('Form submissions have been disabled during development.');
    return false;
  });
});
</script>

Also, feel free to contact me for further code help and/or customization of third-party plugins

@samliew You posted the response in the link below to one of my inquiries back in January, but it appears now that I can’t get this code to work in a new project. Any ideas why? I’m using this for a form that’s contained within a blog post template page.

Could you please edit Screenshot_2017-08-16_140811 and provide ALL the necessary details in your post so we can take a look at your site/issue?

In future if you want faster replies and more accurate answers, I suggest including all the details listed in the link above before someone has to ask.

Hope to hear from you soon. Thanks!

It’s still working for me. You probably have a JavaScript error elsewhere in your code. Always check your console.

1 Like

You can never receive form submissions in Webflow if the form action is modified.

What you can do is leave it blank/default to let the form post to Webflow, but you add a Zapier trigger to do some other thing when Webflow receives the form submission.

1 Like

so there is really no way possible to receive the submission? Not even with custom coding?

1 Like

var listOfFormsToDisabledWebflowSubmission=[“onboardingstep0”,“onboardingstep1”,“onboardingstep2”,“Signup-Form”]
$(“.w-form”).each(function() {
if(listOfFormsToDisabledWebflowSubmission.indexOf($(this).find(“form”).attr(‘id’))!=-1){
$(this).removeClass(“w-form”);
}
});

I’ve achieved this by setting the form action to ‘/’ in the forms settings. It seems to work

If anyone is still in need of a simplified answer, here’s how I’d do it.

  1. add this script to Pages > Page Settings > Before tag
  2. change the jquery selector to the form you’d like to disable.

It waits for the page to load, then sets the submit function of that form to whatever you define below. e.preventDefault() prevents the default action from happening, who’d have guessed!

Take it easy

<script>
document.addEventListener('DOMContentLoaded', function () {
  console.log('loaded')
  $('.form-selector-for-the-form-you-want-to-disable').submit((e) => {
    e.preventDefault()
    const formData = Object.fromEntries(new FormData(e.target).entries())
    console.log(formData)

// Do things with formData

  })
})
</script>
1 Like

This should work but does not. There is still a POST made to the server.
I don’t understand what putting “/” in the action field really does, but it does stop the POST from happening.

1 Like

Thank you for this, it worked for me perfectly :pray:

This brings me to 405 error page saying “Not Allowed”. Is this happening for you?

Would you mind specifying what code is working for you? I have tried everything to disable the form submissions on webflow and nothing seems to be working :confused:

@samliew It’s been a while since you posted this but I just came across the topic and tried it myself. For me this code works perfectly! Also for pushing data from the form to the dataLayer.
However I was wondering why the vanillaJS version of this code does not work. I figured that whatever I do I can not access the form submit event with the vanillaJS.

Do you also have a code that does not use jQuery?