I have a custom list form in SharePoint Online 2013 which after validating using the PreSave() function displays a modal dialog giving the user a choice of two outcomes. This works fine and the user is returned to the lists's AllItems.aspx page.

What I would like to do is return the user to the site's Home Page and have tried to achieve this by using the following code:

WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(saveButtonName, "", true, "", "https://[mydomain].sharepoint.com/sites/dev/SitePages/Home%20Page.aspx", false, true));

The url is valid, and redirects correctly, but I am returned with a SharePoint error:

Sorry, something went wrong

This Page has been modified since you opened it. You must open the page again.

Is there a way to overcome this issue or should I be using another way to skin this particular cat?


How about relying on the Source querystring instead?

Here is a crude example of what I'm getting at:

(function(w) {
  w.PreSaveAction = function() {
    return w.confirm('Have you been working on it?');

  var source = '/sites/dev/SitePages/Home%20Page.aspx';
  var loc = w.location;
  var s = loc.search;
  if (s.indexOf(source) >= 0) return;

  loc.href = loc.href.replace(/\?.*/, '') + '?' + s.replace(/\?/, '').split('&').filter(function(q) { 
    return !q.match(/^source/i); 
  }).join('&') + '&Source=' + source;
  • Thanks for the suggestions. I'm currently focussed elsewhere but will give your suggestion a try in a few days – Fairfield Feb 18 '14 at 23:35

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.