I'm trying to redirect users to a custom URL after hitting the finish button. I can get the page to redirect but the survey isn't marked as completed and no data is saved.

I'm using this below:

<script type="text/javascript" language="javascript">
   function PreSaveAction() {
       var srcUrl=GetSource();
       var newSrcUrl = "http:///sites/surveys/Lists/Test/ThankYou.aspx";
       var i = aspnetForm.action.lastIndexOf(srcUrl);
       aspnetForm.action = aspnetForm.action.substring(0,i) + newSrcUrl ;
       return true;
   }
</script>

Any ideas how to redirect and have the survey marked as complete?

I think there are various ways to do this, below are some of the ways you can try:

1) Customizing your NewForm.aspx and Insert SharePoint Form Action button from "Insert Menu >> SharePoint >> Form Action Button"

Select the Form Actions "Commit" and "Navigate to Page" and click "OK"

Source

2) Using Jquery to change url of new form. The objective is to create a URL that follows this pattern: http://[server]/[list]/NewForm.aspx?Source=[ThankYouPage.aspx].

Source

  • Thanks. 1)But i can't customize my newform.aspx as my survey is a long one with branching and separator. 2)The second option for me too is a bit trick since my finish button is on the editform.aspx not newform.aspx. So don't think any of those 2 optins would help. I have got it to the point where all i need is to make sure the survey is marked as completed. Right now i can redirect but data isn't saved. :( – naijacoder Dec 17 '13 at 5:03
  • 1
    can you try making url of edit form something similar to this: http://[server]/[list]/EditForm.aspx?ID=[id of survey number]&Source=[ThankYouPage.aspx] – Amit Dec 17 '13 at 5:44
  • try this: You can change the default view (the default is overview.aspx) for the Survey list in SharePoint Designer: * Right click on the list * Choose properties * Go to the Supporting Files tab * Change the default view page source – Amit Dec 17 '13 at 5:54
  • Thanks Amit. Can't see these options in SharePoint 2010.Any ideas – naijacoder Dec 17 '13 at 22:33

Have you tried SPServices SPRedirectWithID to do the redirection for you? I'm not sure if it will work with a survey but it is worth a shot.

Hi If anybody still faces same situation It will not work if you redirect in Presaveaction. Even if page redirects the survey will not be completed. Only way is to redirect immediately on page load after the survey completes (i.e. From Overview or AllResponses view using script editor)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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