SPUtility.GetSPField MakeReadOnly Not working on Required Person Field
Domanda
On my edit form I have a required name field that I want to make readonly.
Here is what I have in javascript file:
$(document).ready(function(){
SPUtility.GetSPField("Name").MakeReadOnly();
SPUtility.GetSPField("Date Created").MakeReadOnly();
});
When I do this, on page load I get this:
There is no name next to it.. but if I go into list settings and make the name field not required.. then it works as expected and I can see the name of the person in readonly mode. Additionally, I don't have to do these steps for any other required field other than the person field.
Any work around to this?
Soluzione
It seems to be a known problem with SPUtility.
Please see this answer: SPUtility MakeReadOnly not working on Person fields in edit form
Put below code in window.load() and try.
var peopleField = SPUtility.GetSPField('People Picker Column Name');
peopleField.MakeReadOnly();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange