I'm using SP2013 On-prem and have a list with various columns. I'm doing JavaScript injection on the Editform.aspx (through ScriptEditor web parts) and then overriding the 'Save' button behavior. One of the columns is a Peoplepicker that a user would fill in during edit (on Editform.aspx). When this item is saved, the value entered into the Peoplepicker is not retained (written to the content database). All other fields in the Editform are being saved (retained); only Peoplepicker fields are not being saved.
Also, the statement is always returning false
:
if (SPClientForms.ClientFormManager.SubmitClientForm('WPQ2')); return false;
Commenting out this line doesn't change the behavior.
For the sake of simplicity, I created test list with a simple case which also doesn't save the value in the people picker.
Has anyone experienced this behavior or know how to resolve it?
Example code:
$(document).ready(function () {
var oldPostBackUrl;
var currentSourceValue;
var button = $("input[id$=SaveItem]");
var newPostBackUrl;
button.removeAttr("onclick");
button.click(function () {
if (true) {
var elementName = $(this).attr("name");
var aspForm = $("form[id=aspnetForm]");
oldPostBackUrl = aspForm[0].action;
currentSourceValue = GetUrlKeyValue("Source", true, oldPostBackUrl);
newPostBackUrl = oldPostBackUrl.replace(currentSourceValue, encodeURIComponent(window.location.href));
if (!PreSaveItem()) return false;
if (SPClientForms.ClientFormManager.SubmitClientForm('WPQ2')); return false;
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, "", true, "", newPostBackUrl, false, true));
}
else {
}
})
});