How to create custorm render for field type="User" on EditForm? I need to replace standart peoplePicker control with my custom render.
Code below work without exeptions, but don't set 'Sponsor' field.
var ctx = {};
ctx.Templates = {};
ctx.Templates.Fields = {
'Sponsor': {
'EditForm': function (ctx) {
var formCtx = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx);
formCtx.registerGetValueCallback(formCtx.fieldName, function () {
// Looks like the problem here
return '[{"Key":"i:0#.w|dev\\administrator","Description":"DEV\\administrator","DisplayText":"DEV\\administrator","EntityType":"User","ProviderDisplayName":"Active Directory","ProviderName":"AD","IsResolved":true,"EntityData":{"Title":"","MobilePhone":"","SIPAddress":"","Department":"","Email":""},"MultipleMatches":[],"AutoFillKey":"i:0#.w|dev\\administrator","AutoFillDisplayText":"DEV\\administrator","AutoFillSubDisplayText":"","AutoFillTitleText":"Active Directory\nDEV\\administrator","DomainText":"dev12","Resolved":true,"LocalSearchTerm":"adm"}]';
});
return '<div>MY_PEOPLEPICKER</div>';
}
}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctx);
registerGetValueCallback function return string that I take from EditForm submit request (I use Fiddler tool).
Returning string "1;#administrator" didn't help too.