Make Title field read-only using SPClientTempltes and JSLink in SharePoint Online

js link sharepoint 2013 list view

In this article, I would like to enhance your Client Side Rendering code patterns in SharePoint 2013. Here we will see how can we make Title column or field read only using SPClientTempltes and JSLink in SharePoint Online/2013/2106.

Scenario Make Title field read-only while Item editing

My client asked me to implement a quick change by making Title  field read only when item is editing. This must be a quick and must not include any VS code as it has to be deployed in O365.

SharePoint deveopment training course

Solution using SPClientTempltes and JSLink

I have implemented a solution using SPClientTemplates and added this as a JSLink reference as part of view in list item edit page.

Please follow the below steps to achieve this:

  1. Copy the below code block and save it as “ttlReadOnlyEditPage.js”
  2. Copy / upload the js file on to site asserts / any document library
  3. Open the list and click on any list item
  4. Edit the list item
  5. Click on edit page option as part of site setting gear icon
  6. Edit list view webpart and find for miscellaneous zone
  7. Refer the js file copied in Asserts library and apply the changes
  8. Save the page edit change.
jslink in sharepoint online
js link sharepoint 2013 list view
js link sharepoint 2013 list view
spclienttemplates example
spclienttemplates example

————- Code Block Start ————————

var EnjoySharePoint = EnjoySharePoint || {};
EnjoySharePoint.TitleFieldReadOnly = function () {
varctx= {};
ctx.Templates= {};
ctx.Templates.Fields= {
Title: {
EnjoySharePoint.TitleReadOnly = function (ctx){
————- Code Block End ————————
Hope this helps, happy development in SharePoint Online!!!
Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)


About Krishna Vandanapu

I am Krishna.Vandanapu a SharePoint architect working in IT from last 13+ years, I worked in SharePoint 2007, 2010, 2013, 2016 and Office 365. I have extensive hands on experience in customizing SharePoint sites from end to end. Expertise in SharePoint migration tools like Sharegate, Doc Ave and Metalogix. Migrated SharePoint sites from SharePoint 2007 to 2010 and 2010 to 2013 several times seamlessly. Implementing CSOM with Microsoft best practices. Spent quality time in configuring SharePoint application services like User Profile, Search, Managed Meta data services etc. Now exploring SharePoint Framework and SharePoint 2019

View all posts by Krishna Vandanapu →