Specify page to redirect to when adding a item (new form or edit form)

1. Open your Newform.aspx page
2. Add a CEWP. Type following line in your site url
(http://serverip/Lists/Test/NewForm.aspx?&toolpaneview=2 )
3. Paste below script in source code
<script>
function PreSaveAction() {
var srcUrl=GetSource();
var newSrcUrl = "http://www.google.com";
var i = aspnetForm.action.lastIndexOf(srcUrl);
aspnetForm.action = aspnetForm.action.substring(0,i) + newSrcUrl ;
return true;
}
< /script>


---------------------------------

JQuery for Cancel button:

Use the following jQuery code to override the behavior of the cancel button:


    $(function() {
      $('input[value=Cancel]').click(function() {history.go(-1);});
    });

Comments

Popular posts from this blog

SharePoint 2016 and 2019 Ports

PsConfig step by step /Configuration Wizard. “Upgrade Available” vs “Upgrade required”

Unlock the SharePoint site using Powershell command