0

I'm customizing one of my edit forms with sputility.js to make some of my fields as readonly.

The readonly statement looks like this

SPUtility.GetSPFieldByInternalName('Title').MakeReadOnly();

It works perfectly fine for all fields except Person field. The Person field is not displaying any data after making it readonly. If i switch it back to editable field using MakeEditable() the value is still present.

How do i make the Person fields as readonly using SPutility.js v0.14.2 EDIT:

If i manually call the MakeReadOnly() from console it is working. I have written my code inside document.ready() function only. so it doesn't get called before the page loads.

I tried using _spBodyOnLoadFunctionNames.push(Function) , ExecuteOrDelayUntilScriptLoaded(Function, "sp.js") but they are also not helping.

1

Put below code in window.load() and try.

var peopleField = SPUtility.GetSPField('People Picker Column Name');

peopleField.MakeReadOnly();

Reference Link : http://sputility.codeplex.com/wikipage?title=People%20fields

  • sorry, it is not working. :( still i'm getting blank fields. please see the edit to my question – Abdul Hameed Feb 23 '17 at 5:10
  • Can you please call this in window.load() and try – Samir Khimani Feb 23 '17 at 5:11
  • it is working in window.load() thank you. I still see the edit form before it gets modified by the script. can i reduce that delay. ? – Abdul Hameed Feb 23 '17 at 5:18
  • please modify your answer with window.load. i'll markit as accepted answer – Abdul Hameed Feb 23 '17 at 5:25
  • Already done please check – Samir Khimani Feb 23 '17 at 5:28

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.