March 13, 2015 at 23:01 #7231
Is it possible to add a button in the edit form that will commit changes in the form to the SharePoint list, but post back to the edit form? I’ve tried putting in a header with
and several similar variations, but it seems that because the code is inside DFFS instead of on the native page, it doesn’t get transformed into the proper postback event on page rendering. Is there a quick and easy way to do this?
April 16, 2015 at 02:55 #7428
I ran across this blog which gave me the headstart I needed: https://adrianhenke.wordpress.com/2010/08/19/custom-redirect-after-creating-a-new-sharepoint-item/
The code I added to the JS Section of the Misc tab in the DFFS config of my Edit form is as follows:
//this function renames the Save button to “Save and Stay on Page” and causes the save button to return to the same edit form it came from.
var button = $(“input[id$=SaveItem]”);
button.attr(“value”,”Save and Stay on Page”);
// change redirection behavior
var elementName = $(this).attr(“name”);
var aspForm = $(“form[id=aspnetForm]”);
var oldPostbackUrl = aspForm.get(0).action;
var newPostbackUrl = oldPostbackUrl + “&Source=” +oldPostbackUrl;
if (!PreSaveItem()) return false;
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, “”, true, “”, newPostbackUrl, false, true));
}); //end ready function
April 16, 2015 at 03:56 #7429
I discovered that the approach I just posted saves SOME fields and not others, so its back to the drawing board.
April 23, 2015 at 07:30 #7462Claudia CostaParticipant
I would really like this feature to be available ins the DFFS.
Hope it will be implemented! Looking forward.
April 27, 2015 at 19:08 #7477
I succeeded in changing the onclick event of the Save button to save the record then post back to the edit form, BUT it seems that SharePoint 2013 handles multi-line text fields in some unusual way, because edits made to those fields did not get saved. Anyone attempting to add Save and Stay on Page functionality needs to test thoroughly that all fields are getting saved correctly before putting their solution into production.
- You must be logged in to reply to this topic.