Allow users to only edit one of the fields in a list

Copper Contributor

I have a list that has multiple fields. I only want users to be able to edit one of the fields and I want them to be able to do by directly clicking the items (maybe through a button?) without going to the list or using 'edit in grid'. How can I do so?

3 Replies

Hi @Samson1915 ,

do you mean like inline editing?

Inline Edit.gif

You can achieve that by applying this json formatting to all of the columns you want to make editable.

{
  "elmType": "div",
  "inlineEditField": "=@currentField",
  "txtContent": "=@currentField"
}


See more information here https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/formatting-advanced#inlin... 

Or you can do some more advanced stuff, like this sample that provides some buttons that set the approval state of an item

https://github.com/pnp/list-formatting/tree/master/column-samples/approval-buttons-setValue-status-u... 

Best Regards,
Sven

Hi Sven,

 

Thank you for your reply. I am aware of the inlinEditField and I have tried it. I am working on the Gallery layout and when I apply the code, only the title field can be edited which is not my designated field. I wonder how I can choose which field to edit.

 

Best regards

Samson

 

@SvenSieverding 

Hi @Samson1915 ,

you can do the following to make a text field (like Value in my example) editable in gallery view

SvenSieverding_0-1687498430043.png
First copy your gallery view formatting code and put it into a text editor.

copy.gif

Then find the line that displays your field "Value"

"txtContent": "=if ([$Value] == '', '–', [$Value])"


and add this line above or below it.

"inlineEditField": "[$Value]",


Paste the resulting code back into the code editor on the  "Format View" screen and confirm with "Save"

SvenSieverding_1-1687499076532.png

 

Now "Value" is inline editable in "Gallery View"

inlineedit.gif

Best Regards,
Sven