SharePoint Survey – Redirect to Thank You Page on Finish

Requirement is to redirect users to Thank You Page in SharePoint Survey on clicking Finish button.

One quick trick that comes to my mind is: Appending Source parameter to the Survey’s NewForm URL.
E.g.
http://sharepoint.crescent.com/Lists/TownhallMeetingSurvey/NewForm.aspx?source=/SitePages/thankyou.aspx

Not a bad idea, But the problem is: It doesn’t matter whether you click on the “Finish” or Cancel button, You will be redirected to the “Thank You” page! Also, it won’t work when you have branching enabled in SharePoint Survey!

How to Create a Thank You page for SharePoint Survey?

Let’s overcome the above issue with the SharePoint designer.

1. Create a new Web Part page (not Wiki page!) and place some descriptive content and/or images in it. I’ve made the below page. Named it as “thankyou.aspx” under SitePages.

 sharepoint 2010 survey thank you page

2. Open the site in SharePoint Designer, Go to “Forms” section. Create a New Form by clicking on “New Item Form”
sharepoint 2010 survey thank you

 3. Give it a Name,  Choose form type as “New Item Form” and enable “Set as default form for the selected type” and click on “Ok” to create the new form.
sharepoint survey redirect

4.  Edit the New form we’ve just created. Open the “New.aspx” page in SharePoint Designer. Go to Design view and delete all two “Finish” buttons.

5.  Insert SharePoint Form Action button from “Insert Menu >> SharePoint >> Form Action Button”
sharepoint 2010 survey finish redirect

6. Select the Form Actions “Commit” and “Navigate to Page” and click “OK”
sharepoint survey thank you page

7. Click on the “Form Action” input button and go to code view. Update the code for input button as:

<input type="button" value="Finish" name="btnFormAction" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={/sites/marketing/SitePages/thankyou.aspx}')}" style="width: 119px" />

8. Save and close the page. That’s all!

See the SharePoint 2010 survey thank you page in action:
sharepoint 2010 survey add thank you page

Another method to add thank you page in SharePoint 2010 survey:

If you don’t want to use the SharePoint designer method as illustrated above, there is another way. Create an additional question at the end of the survey, as “Thank You for participating in Survey! Click on Finish to complete.” of  “Single Line of Text”. Add page separator just before this last question. Go to the Survey, Navigate to the last question, and edit the page. Insert a CEWP, place the below code in it.

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> 
//Or place the jquery.js file in 14 hive and refer it
<script type="text/javascript">
 $(document).ready(function()
  {
      //Hide the Text field for Thank you Question
      $("input[title$='Thank You for participating in Survey! Click on Finish to complete.']").parent('span').parent('td').parent('tr').hide();
  
 });
</script>

This code will hide the single line of text input field and give thank you message. See the above code in action:

sharepoint 2010 survey thank you message

Here is my another post on sending users to thank you page from SharePoint list forms: Redirect Users to Thank You page from NewForm.aspx in SharePoint

Thank You page for SharePoint 2013/2016 Survey:

Use this Script in a Script Editor Web part.

<script type="text/javascript" language="javascript">

function changeRedirect(options) {
    for (var i = 0, buttons = document.querySelectorAll(options.selector); i < buttons.length; i++) {
        var newOnClick = function(originalOnClick) {
            return function(){
                Nav.navigate = STSNavigate = function() {
                    window.location = options.redirectTo
                }
                originalOnClick()
            }
        }
        buttons[i].onclick = newOnClick(buttons[i].onclick)
    }
}
 
document.addEventListener("DOMContentLoaded", function(event) {
    changeRedirect({
        selector:   "input[value=Save]",
        redirectTo: "https://yoursite.com/pages/thankyou.com"
    })
    changeRedirect({
        selector:   "input[value=Cancel]",
        redirectTo: "https://yoursite.com/"
    })
})

</script>

Salaudeen Rajack

Information Technology Professional with Two decades of SharePoint Experience.

22 thoughts on “SharePoint Survey – Redirect to Thank You Page on Finish

  • March 13, 2021 at 2:05 PM

    Code in 2nd method, does not work for SP 2013 survey.

    Reply
  • June 15, 2018 at 12:39 PM

    Hi, redirection is not working for my 2010 SS designer option two… I was hoping to use it. Any suggestions?

    Reply
  • February 20, 2018 at 9:51 PM

    In 2013 the redirect works perfectly – unfortunately the survey does not get marked as complete.

    Reply
  • February 20, 2018 at 10:36 PM

    Gah! I missed the new code for 2013/2016. It looks like there’s something malformed in changeRedirect parts b/c it’s being ignored. (And it makes JSLint very angry)

    Unfortunately I cannot figure out how to paste code into the comments here…

    Reply
  • January 30, 2018 at 7:23 AM

    unfortunately, I got error page after click “Finish”, what is the problem?

    Reply
  • June 18, 2017 at 10:12 AM

    I am using this in Office 365:

    function changeRedirect(options) {
    for (var i = 0, buttons = document.querySelectorAll(options.selector); i < buttons.length; i++) { var newOnClick = function(originalOnClick) { return function(){ Nav.navigate = STSNavigate = function() { window.location = options.redirectTo } originalOnClick() } } buttons[i].onclick = newOnClick(buttons[i].onclick) } } document.addEventListener("DOMContentLoaded", function(event) { changeRedirect({ selector: "input[value=Finish]", redirectTo: "https://myteams.toyota.com/sites/tmnaisa/OCIO/CTI/CommSecure/SitePages/thankyou.aspx" }) changeRedirect({ selector: "input[value=Cancel]", redirectTo: "https://myteams.toyota.com/sites/tmnaisa/OCIO/CTI/CommSecure/SitePages/thankyou.aspx" }) })

    Reply
  • June 13, 2016 at 4:59 PM

    great, worked well. Not with a survey with branching.
    I am testing option 2

    Reply
  • October 14, 2015 at 12:51 PM

    i have tried the same thing but for some reason my URL doesnt work,i get an error,

    i am sure why if i put bbc.co.uk it works but not our url

    Reply
  • July 24, 2015 at 9:43 PM

    I am using SharePoint 2010 and SharePoint 2010 Designer and when I created my custom form, I lost all of my branching. How can I re-establish the branching I need on my survey?

    Reply
  • April 2, 2015 at 12:50 PM

    Hi
    I am using SharePoint 2013 and I cannot insert the form action control. It won’t let me drop any dataview control in the code anywhere. Can you help me out?

    Reply
  • March 20, 2015 at 12:53 PM

    Hi,

    Please how can you do this in SharePoint 2013 or SharePoint online. Thanks

    Reply
  • March 11, 2015 at 11:07 PM

    For the second method. How do you edit the page to add the CEWP?

    Reply
    • March 12, 2015 at 9:08 AM

      Are you not getting “Edit Page” option in Site Settings Menu? If not, Append “?PageView=Shared&ToolPaneView=2” to your EditForm.aspx page.

      Reply
  • February 26, 2015 at 2:33 PM

    Please how can you do this in SharePoint designer 2013.thanks

    Reply
  • October 16, 2014 at 4:39 AM

    Worked with first option except switching to code view I simply added the URL in the settings option of “Navigate to page.” However, after doing so makes my cancel/go back button not work at all. Any suggestions?

    Reply
  • July 12, 2014 at 2:07 PM

    form submit not checking field validations.plz help me

    Reply
  • June 27, 2014 at 10:09 AM

    I did the first option (and controlled twice) but i got “The data source control failed to execute the insert command” when clicking on “Finish”. Any idea ?

    Thanks

    Reply
  • November 15, 2013 at 1:47 PM

    ITS WORKED WITH SECOND OPTION.

    Reply
  • September 12, 2013 at 8:32 PM

    EXCELLENT POST. ITS WORKED WITH FIRST OPTION.

    Reply

Leave a Reply