How can I make my form submit button open in a new tab after redirecting in Webflow?

TL;DR
  • Under Project Settings, enable jQuery for your Webflow project.
  • Add a custom jQuery script in the Page Settings' Before </body> tag section to open the form's redirect URL in a new tab, then test after publishing.

To make your form's submit button open a new tab after redirecting to a success page in Webflow, there are some configuration steps needed.

1. Use Custom Code

  • Access Project Settings: Go to your Webflow project's settings.
  • Enable jQuery: Make sure jQuery is enabled for your project since it simplifies scripting.

2. Add Custom Script

  • Go to the Designer: Click on your form and open the form block settings.
  • Insert Code: Use the following jQuery script to ensure the redirect occurs in a new tab:
  • Place this in the Page Settings under the Before </body> tag area for the specific page containing your form.
  • ```javascript

    <script>

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

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

      var url = $(this).attr('action'); // Gets the action URL from the form

      window.open(url, '_blank'); // Opens the URL in a new tab

    });

    </script>

    ```

3. Test Form Submission

  • Publish Changes: After adding the script, publish the site to test the form.
  • Check Functionality: Ensure that on form submission, the redirect target opens in a new tab as intended.

Summary

To make a form submit button open a redirect URL in a new tab in Webflow, use a custom jQuery script attached to the before </body> tag section of the page settings. This ensures that the form redirects as expected without manually editing HTML code.

Rate this answer

Other Webflow Questions