Make a property read-only after initial set in UI

Is there a way to make a property read-only in the UI after the first time it has been set?
Kind of like how the ID field is being handled.

What field type are you talking about? For most you have three options:

  1. You can disable editing of the field in the content model but that completely removes the field from the entry editor (which is not what I’m guessing you want). It will still be delivered via the API, just not visible in the webapp.
  2. If you have an enterprise account with custom roles and permissions, you can disable editing of a specific field for certain roles.
  3. Make a simple UI extension which allows editing of the field if the value is "" (i.e. blank) else only shows the value of the field.

The last approach introduces a problem though: how to edit the field after it is set initially?

short string and integer.
The functionality I’m after is actually what you propose in option 3.
The editor will be able to put in the values when first creating the content, but not change it after it has been set. (Kind of like the actual ID of a content)

Ended up writing an extension for it.
Simple, but does the job.
https://github.com/Steddie/Contentful.Extension.LockedField

1 Like