New Form: When the people picker field is set to read only, the field is not displayed
Posted: 15 May 2020
Hello all,
i add a script to a people picker field, so that the logged in user is automatically entered. When i set the field to read only, it is not displayed. Can I use a script or what can I do?
Here is my script:
// Load current user login
SP.SOD.executeOrDelayUntilScriptLoaded((function () {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
ctx.load(web);
var user = web.get_currentUser();
user.retrieve();
ctx.executeQueryAsync(
function () {
// Set user login
fd.field('User_x0020_name').control().value(user.get_title());
// Run validation by emulating validation image click
fd.field('User_x0020_name').control()._el().find('a:eq(0)').click();
});
}), "SP.js");
Best wishes and take care
Tom
i add a script to a people picker field, so that the logged in user is automatically entered. When i set the field to read only, it is not displayed. Can I use a script or what can I do?
Here is my script:
// Load current user login
SP.SOD.executeOrDelayUntilScriptLoaded((function () {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
ctx.load(web);
var user = web.get_currentUser();
user.retrieve();
ctx.executeQueryAsync(
function () {
// Set user login
fd.field('User_x0020_name').control().value(user.get_title());
// Run validation by emulating validation image click
fd.field('User_x0020_name').control()._el().find('a:eq(0)').click();
});
}), "SP.js");
Best wishes and take care
Tom