Redirect after successfully submitting form

3 Kommentare

  • Ahmed Zaid
    Community Moderator

    Hi Amy Giella,

    I tested the following modification on Copenhagen 2.18.0

    if (document.referrer.match('/requests/new') && (window.location.href.indexOf("return_to=%2Fhc%2Frequests") !== -1)) { 
      window.location.href = 'URL';

    Basically I noticed that the theme has a default redirect to guide home with the query param return_to=%2Fhc%2Frequests, so you can look out for it and redirect the end user.

    Hope that helps.

  • Amy Giella

    Hi Ahmed Zaid,

    Thank you for taking a look at this! I used this in the document.head.hbs after replacing "URL" with the custom page's URL. It does make the user fill in all the required fields before submitting the form, but instead of taking me to the custom page, I am taken back to the main home page. Am I maybe adding the code to the wrong place? I'm not sure what else to try.

  • Ahmed Zaid
    Community Moderator

    Hi Amy,

    It works for me whether I add it to the top of the header template or directly in the script.js file. Can you try adding the url as


    Replace only your_page_title


Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Powered by Zendesk