0

I have create a survey and I would like that after the user clicks on 'Finish' that he gets redirected to a random page (e.g. google in this case).

I wrote the below code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>

    <script type="text/javascript">


// Sends user to a new page after completing the survey (newform not dialog)

 $(document).ready(function()
  {
  $('input[value=Finish]').click(function() { window.location.replace("http://www.google.com");});
 });
   </script>

The redirection works. However the answers are not saved... Could you please help me?

Thanks! Cheers

0

First create a new page in SitePages. Name it like "thanksForYourAnswer" and give some text and maybe a hyperlink to the homepage.aspx called "click here to get to start page".

After this create a text file (maybe script.txt) and enter this code:

<script type="text/javascript">
<!--
 window.location = "https://sharepoint.tld.de/departments/Site/_layouts/15/start.aspx#/SitePages/thanksForYourAnswer.aspx";
//–>
</script>

Save the text file and drop it to your SiteAssets library. Copy the url to this uploaded text file.

Now click your survey list in site contents. Here you are in that location where the survey leads people who finished the survey. Edit the page (gear in right hand corner - edit) and add a content editor webpart. In content editor web part properties paste the link to your text file to make the web part run the script. End editing.

Now everyone entering that survey will be redirected to the url in the text file. You can enter survey settings by using the three dots on the survey app in site contents. If you want to end this behavior - just edit the script text file in site assets and comment the line for redirecting.

You can share the link for doing the survey by Newsfeed or on any other way as the users will be redirected if they try to enter the survey by clicking the app.

  • Dear Phil Thanks a lot this is actually quite helpful! One comment though, how can I then access the results of the survey? Before i was going to the survey overview and clicking on show results. But now with the redirection this is not possible. Is there any way to actually have the redirection done within the survey with the finish button while keeping the submit action? – Aqualover Feb 27 '18 at 16:52
  • Dear Aqualover, you can access the survey results by temporarily disabling the script - i.e. by renaming the text file. Just open the survey results and add this page to your browser favorites. You will be able to open it any time - even with activated script. Then make the script work again (by e.g. renaming the file to old name). I do not know any way to easily change the buttons direction. If my solution meets your requirements I would love to get it marked as a solution. – PhilFancy Feb 28 '18 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.