CSR code samples #8 (Read-only SP Controls)

Sometimes we need to allow user edit list item but without touch some fields, this will enhance the form user experience if no need to modify these filed.

 
 
 
 
 
5 Star
(6)
1,015 times
Add to favorites
3/19/2015
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Help with dinamic readonly fields
    1 Posts | Last post May 14, 2018
    • Thank you for this Muawiyah Shannak!
      
      I'm struggling with the readonly logic. Is there any option so the field is readonly based on the current user?
      
      If the user belongs to a Owners groups, I would like the field to be editable. But, if the current user belogns to a different group I'l like to keep the field read only.
      
      I'm using your code, works perfectly but, When I try to use the Sharepoint API, It just does not work :(
      
       function getCurrentUserGroupColl(UserID)
       {
       
       console.log("entre");
       console.log(_spPageContextInfo.webAbsoluteUrl+ "/_api/web/GetUserById("+UserID+")/Groups");
       
       $.ajax({ 
      	url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/GetUserById("+UserID+")/Groups",
      	method: 'GET',  
      	headers: { 'Accept': 'application/json; odata=verbose' },  
      	success: function(data){      
      	console.log("succes")            
      	},
      	error: function (data){  
                      console.log("falle");
          } 
        });
      }
  • Thanks
    1 Posts | Last post February 14, 2018
  • Code CSR et IE 11
    1 Posts | Last post October 10, 2016
    • Les codes CSR fonctionnent sous Edge mais pas sous IE 11.00.
      Avez vous ces mêmes exemples de codes pour ce navigateur ?
      Merci
  • Code CSR et IE 11
    1 Posts | Last post October 10, 2016
  • Code CSR et IE 11
    1 Posts | Last post October 10, 2016
  • Use CSR in Datasheet View
    1 Posts | Last post May 16, 2016
    • Hi,
      Can we apply this scenario to a custom Datasheet view? if yes, please guide me to right way so i can proceed.
      Another inquiry, where we can define the specific name of a custom view in the code.
      
      Thank you in advance,
  • Default Attachment control not working
    1 Posts | Last post February 03, 2016
    • Hi Muawiyah,
      I have customized SharePoint List using CSR. The default attachment field (List -> add new item -> ribbon -> attach)is not working and it is showing error:
      This form was customized and attachments will not work correctly because the HTML 'span' element does not contain an 'id' attribute named 'part1'.
      Your help will be greatly appreciated!
      Thanks!
      
  • Deployment
    1 Posts | Last post January 11, 2016
    • These seems like the solution I am after, but I am having trouble getting it to work at all.  I downloaded, modified to reference the fields I need to make read only (Content Type, Task Name, Description, % Complete, and Task Status), but when I upload to my web part, nothing happens.  I have the file stored in the style library.  Am I missing something?
      
      Thank you!!!