Thursday, August 27, 2015

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">

try
{
$(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["context"].baseURI;

            var currentSourceValue = GetUrlKeyValue("Source", true, oldPostbackUrl);

            var newPostbackUrl = oldPostbackUrl.replace(currentSourceValue, "/SitePages/Home.aspx");

            if (!PreSaveItem()) return false;
            WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, "", true, "", newPostbackUrl, false, true));
        });
   
});
}
catch(e)
{
alert(e);
}
</script>

No comments:

Post a Comment