3

How can I make a column read only when in quick edit view? I have a column which is already in a read only using the infopath form but I can still edit it when I am in quick edit view.

1

3 Answers 3

2

I know this question is a bit old. Am putting my solution for others who might have similar requirements, this is how I did it in my project using javascript:

https://wditot.wordpress.com/2016/02/02/sharepoint-2013-disable-multiple-columns-in-quick-edit/

Alternative method

The code uses javascript, so for folks who do not want to get their hands dirty:

  1. Create a calculated column in your list that has same value as the column that you want to make read-only.

  2. Now, in the view, replace the original column with the calculated column.

This works for simple and less number of columns. However, for making large number of columns read-only you are better off using the script.

2

Edit the page in SPD and on the Xslt View Webpart, on the ViewFields element, add the attribute ReadOnly="TRUE" to the field you want to be read-only:

<WebPartPages:XsltListViewWebPart runat="server" ... >
    <XmlDefinition>
        <View ... >
            <Query>
                <ViewFields>
                    <FieldRef Name="ano_mes" ReadOnly="TRUE"/>

(Make sure the FieldRef element you are editing is inside the ViewFields tag. On my first attempt I edited the FieldRef element inside the <OrderBy> element - this will not work.)

Credits: Luck Tech Share

0
0

Since you are using InfoPath I am assuming you may not want to use code to accomplish this so I am going to provide a few codeless methods. There are multiple JavaScript options similar to what Prakash suggested. Here is another code example: http://chuvash.eu/2014/11/28/disabling-a-column-in-quick-edit/

Option 1. In advanced list settings you can turn off the ability to use quick edit. Option 2. Use a calculated column to to display the information in the views. Only use this calculated column in any view.

2
  • how can I paste the codes you mentioned? I am not knowledgeable in javascripting yet
    – Ehj Daria
    Commented Nov 25, 2015 at 10:54
  • You can either put them in a script editor web part added to the form or insert into the placeholdermain section of the form using SharePoint Designer. Please mark as answer or at least vote up if my information helped you. Commented Jul 22, 2016 at 18:22

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.