0

This question already has an answer here:

I have a sharepoint 2013 list. When the user clicks on edit this list to open it in a datasheet view...after making changes when clicked on stop ,the data should be saved and redirect to another page. Is this possible?

Thanks in advance

marked as duplicate by Danny '365CSI' Engelman, Dikesh Gandhi, Asad Refai, Mohamed El-Qassas MVP, Robert Lindgren Apr 6 '17 at 12:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Can it be redirected from the datasheet view? – Dheeraj Apr 5 '17 at 15:46
  • Only when you hook into Microsofts events with Javascript (somehow) – Danny '365CSI' Engelman Apr 5 '17 at 16:48
  • I have tried to redirect it based on the url..but after clicking stop editing this list..the page is not loaded again – Dheeraj Apr 6 '17 at 5:17
2

This is without using jquery

Create a custom new list form.

Remove/Comment the save button and add new save button instead

<input type="button" class="Add-button" value="Save" name="btnSave" onclick="if (!PreSaveItem()) return false;{ddwrt:GenFireServerEvent('__commit;__redirect={/SiteAssets/Thank%20You.aspx}')}"

In PreSaveItem() , you can write your validation code if required!

  • Can it be redirected from the datasheet view? – Dheeraj Apr 5 '17 at 15:47
0

You can use the below script to redirect to another page after submitting the form. you can use any jquery reference.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

$(document).ready(function() {

var button = $("input[id$=SaveItem]");
// change redirection behavior
    button.removeAttr("onclick");
    button.click(function() {
        var elementName = $(this).attr("name");
        var aspForm = $("form[name=aspnetForm]");
        var oldPostbackUrl = aspForm.get(0).action;
        var currentSourceValue = GetUrlKeyValue("Source", true, oldPostbackUrl);
        var newPostbackUrl = oldPostbackUrl.replace(currentSourceValue, "MyRedirectionDestination.aspx");

        if (!PreSaveItem()) return false;
        WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, "", true, "", newPostbackUrl, false, true));
    });

});
  • Can it be redirected from the datasheet view? – Dheeraj Apr 5 '17 at 15:47

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