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

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 ? – Mathew Apr 7 '17 at 14:45
  • Suresh Answer this question ! Somewhere – Mathew Apr 7 '17 at 16:50

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.