1

I have a SharePoint list containing items. If I click edit button, It will open the datasheet view and add item. And click the “stop ” button I come back to the list again.

How can I be redirected to a specific sharepoint site/page (i.e. Home) after I clicked the “stop ” button. Thanks again

1 Answer 1

-1

This is a novel approach I developed to get more flexibility and stability for the redirection behavior. It allows to set the redirection on the client side.

$(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));
        });

});
2
  • Where can I put this script ? NewForm.Aspx or other ? Commented Apr 7, 2017 at 14:45
  • Suresh Answer this question ! Somewhere Commented Apr 7, 2017 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.