Unable to redirect page after Survey is created?

Hi,

I have the following code in a Script Editor Web Part.

<input type="button" value="Add Survey" onclick="openPopup('../_layouts/15/new.aspx?featureid=%7B00bfea71-eb8a-40b1-80c7-506be7590102%7D&amp;listtemplate=102&amp;Source=http%3A%2F%2Fourdomain%2FJohnTest%2F%5Flayouts%2F15%2Fviewlsts.aspx','Adding Survey','','',''); return false;"></input>

The openPopup function just opens a dialog using SP.UI.ModalDialog.showModalDialog(options).

I cannot get the page to redirect after the survey is created. Do I need to call an inbuilt Dialog Pop-up to get "&source" picked up and used?

Have tried the

onclick="javascript:SP.UI.ModalDialog.ShowPopupDialog('../_layouts/15/new.aspx?featureid=%7B00bfea71-eb8a-40b1-80c7-506be7590102%7D&amp;listtemplate=102&amp;isDlg=0&amp;Source=../_layouts/15/viewlsts.aspx'); return false;">

Thanks.

John. 


September 9th, 2015 7:59am

Hi John,

We can use  dialogReturnValueCallback property in the ShowPopupDialog to achieve it, the following code for your reference:

<script type="text/javascript">
     //******** Dialog with Data from Pop Up Starts Here ***********/
     function openDialogAndAddSurvey() {
         var options = {
             url: '../_layouts/15/new.aspx?FeatureId=%7B00bfea71%2Deb8a%2D40b1%2D80c7%2D506be7590102%7D&ListTemplate=102&', 
             dialogReturnValueCallback: onPopUpCallBackWithData
         };
         SP.UI.ModalDialog.showModalDialog(options);
     }
  
     function onPopUpCallBackWithData(result, returnValue) {
         window.location.href="../_layouts/15/viewlsts.aspx";
     }  
 </script>
<input type="button" value="Add Survey" onclick="javascript:openDialogAndAddSurvey()"></input>

Best Regards,

Dennis Guo

Free Windows Admin Tool Kit Click here and download it now
September 10th, 2015 12:25am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics