in

SharePoint University

Clean slate. Nothing but SharePoint.
Go, SharePoint!

Making Few Columns Read-Only in a List

Last post 07-17-2008 5:07 AM by Daissyy. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 05-19-2008 1:44 PM

    Making Few Columns Read-Only in a List

    Hi,

    We've created a list to allow users enter few data elements. Users will enter data in few columns based on data in first 3 cloumns. These 3 columns will have data fetched from external tables (using BDC). As we don't want users to change these data, we want to just show them to users - making them read-only.

    How can we do it.

    Any help is appreciated.

    Sharepoint.net

    Filed under:
  • 06-24-2008 12:44 PM In reply to

    Re: Making Few Columns Read-Only in a List

    So many questions....so few answers.  If anyone figures this out, please let me know!  Thanks.  donna.sullivan@rotary.org

  • 06-24-2008 1:41 PM In reply to

    Re: Making Few Columns Read-Only in a List

    There is no column leve security in SharePoint, however you have some options to accomplish your goal.

    My recommended option is to write an event handle to catch any attempt to update illegal fields. Use an ItemUpdating event handler to check if the 'locked' fields are updated. This should be combined with either removing the locked fields from the edit/new form or by just displaying them without the edit field.

    You may be tempted to just remove the fields or display them uneditable without implementing the event handler, however this only provides security through obscurity and any attempt to update the fields using other means than web access will allow the fields to be updated.

    To modify the forms you can either provision the list using custom list forms or use SPD to create a new display form. Open the editform.aspx or newform.aspx of the list in SPD. Select the entire form and delete it, or you can just select 'default to master content' from the smart tag to remove everything. If using the latter approach, select Custom content from the PlaceHolderMain smart tag and place your cursor where you want to custom form to be placed. Then, go to Insert->SharePoint Controls->Custom ListForm. Select the appropriate options in the dialog and you should now have full access to customize your form, including replacing any editable fields (SharePoint:FormField [...] ControlMode="New") with displaying fields (ControlMode="Display").

    Good luck!

    .b


    My SharePoint blog with articles, reviews, and code samples.

    Anonymized questions and answers may be posted to my blog.

    Blog for my new developer book on the SharePoint User Experience

    Win my brand new book, signed and inscribed, shipped to your door on release.

    If, after a few days, I have not responded to a thread in which you have requested my assistance, please let me know by email furuknap<[at]>gmail.com. I am not ignoring you but I do get 20-30 requests each day and some responses might be lost.
  • 06-24-2008 1:43 PM In reply to

    Re: Making Few Columns Read-Only in a List

    We are working with the List Display Settings feature posted on Codeplex by Laurent Cotton (Bewise):

     http://www.codeplex.com/SPListDisplaySetting

    This feature allows you to select which list columns can be set to display only or be editable on the New, Edit and Display forms of the list. This can also be configured to be different based on membership in a site security group. Doesn't seem to work on individuals with site permissions, however. But then again, we shouldn't be using those. Using this just requires careful management and set up but then it is very useful. Bewise also has one for limiting Views based on group membership. Together these two features add a lot of control to a list.

     Please try this out on a lab server before you implement on production.

    Filed under: , , ,
  • 06-25-2008 12:29 AM In reply to

    • akash
    • Not Ranked
    • Joined on 02-05-2008

    Re: Making Few Columns Read-Only in a List


    open newform.aspx and editform.aspx in SPD and write this code inside placeholdermain content . In this case i am creating title field as readonly.

    <script type="text/javascript" language="javascript" >
    function check()
    {
     var elements=document.body.getElementsByTagName("*");
      for (index=0; index < elements.length;++index)
      {
       if(elements[index].tagName=="INPUT")
       {
        if(elements[index].type=="text")
        {
            if(elements[index].title=="Title")
            { 
                  elements[index].readOnly=true;
             }
        }
       }   
      }  
     
     
     }
    _spBodyOnLoadFunctionNames.push("check()");
    </script>

    In this case I am creating title field as readonly.

  • 06-25-2008 2:33 AM In reply to

    Re: Making Few Columns Read-Only in a List

    While your solution may seem to solve the problem, in reality in only disguises the fields. In effect, only edits done through that form will be affected and only if the client has enabled javascript. Any attempt at editing the fields in any other way, for instance through the OM, custom forms or using third-party tools will succeed in editing the seemingly read-only fields.

    As SharePoint really does not have column level security you cannot fake it effectively other than through code. You cannot rely on your users 'begin nice'.

    Another option that I did not mention is to not have the fields at all. By this I mean that your can display, using a linked data source, fields from other lists in your views. So, have only the fields you want and need in the editable list and display those along with fields from other sources in your view o the pages. Using SPD or OM to create a linked source is not hard and gives you great flexibility to create sub queries and views.

     Good luck!

    .b


    My SharePoint blog with articles, reviews, and code samples.

    Anonymized questions and answers may be posted to my blog.

    Blog for my new developer book on the SharePoint User Experience

    Win my brand new book, signed and inscribed, shipped to your door on release.

    If, after a few days, I have not responded to a thread in which you have requested my assistance, please let me know by email furuknap<[at]>gmail.com. I am not ignoring you but I do get 20-30 requests each day and some responses might be lost.
  • 07-17-2008 5:07 AM In reply to

    Re: Making Few Columns Read-Only in a List

    Hi, SharePoint.net,

    There is an SharePoint Add-ons - SharePoint Permission Boost which can fulfill your demands.

    It can set columns' permissions as read-only or invisible so that you can make sensitive columns invisible in list views after your setting of unique list views.

    It can also set items' permissions uniformly without set them one by one and can add or remove partial permissions of items for unique users.

    click this for more info: http://www.sharepointboost.com/permissionboost.html

    Hope this can help you!

    www.SharePointBoost.com
    SharePoint Add-ons: Enhancement for Alert, Reminder, Permission, Lookup, RichText, Password change

    services@sharepointboost.com
Page 1 of 1 (7 items)

Need SharePoint Training? Attend a SharePoint Bootcamp!
Forum content (c) original posters. Everything else (c) 2008 SharePoint Experts, Inc.