0

I'd like to set a richtext field to read-only via Javascript/JQuery. Would be great if it works at SP 2013, 2016 and SharePoint Online

3 Answers 3

1

I guess you want the field to become read only once the end user has enteded some Content? In that case the field should be read write in the New form and read only in the Edit form which can be done by inserting a tiny script in the Edit form

An example : https://www.c-sharpcorner.com/code/816/make-a-sharepoint-list-form-field-read-only-with-jquery.aspx

4
  • This is not working with a richt text field, since it is not an input... Commented Mar 22, 2018 at 23:26
  • Ok, does this works, social.technet.microsoft.com/Forums/sharepoint/en-US/… Commented Mar 22, 2018 at 23:31
  • Just remember you can edit list content in other ways. The edit form is not the only way so the content can still be changed. For example: "Quick edit" Commented Mar 23, 2018 at 0:46
  • True, but that can be disabled too. The requirement is kind of broard so NewForm could be a good starting point 😊 Commented Mar 23, 2018 at 10:59
0

Found it... there seems to be an additional property used by SharePoint scripts that enables and disables the field.

inputDivOBJ.find('[id$="inplacerte"]').prop('contenteditable','false');
0

SPUtility plugin does this job perfectly. Load SPUtility and run the following script inside document.ready

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

To make the field editable again use the following line

SPUtility.GetSPFieldByInternalName('InternalNameOfRichTextField').MakeEditable();

This functionality works only in forms not on Quick Edit Views like most JS validation solutions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.