How can I disable the Webflow success or failure state for a sign-up form and display a custom thank you page using jQuery and the Webflow form submit state?

TL;DR
  • Navigate to your Webflow project, select the form, and add necessary jQuery in the Footer Code section.
  • Implement a script within the form's custom code settings to handle form submission via AJAX for redirection to a custom thank you page. 
  • Publish the site to apply changes.

If you want to redirect users to a custom thank you page instead of using the default Webflow success or failure messages, here's how to achieve that using jQuery.

1. Access and Edit the Form

  • Open your Webflow project and navigate to the page containing the form.
  • Select the form element you want to customize.

2. Add jQuery to the Project

  • Go to Project Settings and click on the Custom Code tab.
  • Scroll down to the Footer Code section.
  • Add jQuery if it's not already included: <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-KyZXEAg3QhqLMpG8r+Knujsl5/fw94rYM8UmcFrBg/Q=" crossorigin="anonymous"></script>.
  • Add your custom script below the jQuery inclusion.

3. Implement Custom Success Logic

  • Access the form's custom code under the Form Settings in Webflow Designer.
  • Add the following script to handle the form submit event:

  ```plaintext

  <script>

    $(document).ready(function() {

      $('form').submit(function(event) {

        event.preventDefault(); // Prevents the default form submission

        var form = $(this); // Current form

        $.ajax({

          type: 'POST',

          url: form.attr('action'),

          data: form.serialize(),

          success: function(response) {

            // Redirect on success

            window.location.href = 'https://www.your-custom-thank-you-page.com';

          },

          error: function(xhr, status, error) {

            // Log or alert error if needed

            console.error('Form submission error:', error);

          }

        });

      });

    });

  </script>

  ```

4. Publish Your Project

  • Publish your site to ensure the changes take effect.

Summary

To bypass Webflow's default form submission success or failure messages, use a jQuery script to intercept the form's submit action. Redirect users to a custom thank you page by handling the submission via AJAX and overriding default behaviors.

Rate this answer

Other Webflow Questions