Question

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:

enter image description here

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?

Was it helpful?

Solution

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();
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top