1

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?

  • What version of SharePoint you are working on? – Marek Sarad Mar 12 at 14:47
  • @MarekSarad SharePoint 2016 – Grizzly Mar 12 at 14:48
1

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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.