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.
https://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

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

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

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

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

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

    Reply
  • 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
  • unfortunately, I got error page after click “Finish”, what is the problem?

    Reply
  • 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
  • great, worked well. Not with a survey with branching.
    I am testing option 2

    Reply
  • 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
  • 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
  • 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
  • Hi,

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

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

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

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

    Reply
  • 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
  • form submit not checking field validations.plz help me

    Reply
  • 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
  • ITS WORKED WITH SECOND OPTION.

    Reply
  • EXCELLENT POST. ITS WORKED WITH FIRST OPTION.

    Reply

Leave a Reply

Your email address will not be published.