# Read only collection field

**URL:** <https://discourse.getcockpit.com/t/read-only-collection-field/1453>\
**Category:** General\
**Created:** [May 12, 2020, 3:45am UTC](https://discourse.getcockpit.com/t/read-only-collection-field/1453 "2020-05-12T03:45:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hosseiny](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/hosseiny/32/715_2.png) [@hosseiny](https://discourse.getcockpit.com/u/hosseiny)\
**Post date:** [May 12, 2020, 3:45am UTC](https://discourse.getcockpit.com/t/read-only-collection-field/1453/1 "2020-05-12T03:45:39Z")

</div>

I’m currently posting a form to a collection.  
For convenience, is there a way to make a collection field read-only?

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [May 12, 2020, 5:26pm UTC](https://discourse.getcockpit.com/t/read-only-collection-field/1453/2 "2020-05-12T17:26:45Z")

</div>

You could use the `collections.save.before` event in `/config/bootstrap.php`.

```php
$app->on('collections.save.before.form_collection_name', function($name, &$entry, $isUpdate) {
    if ($isUpdate) $this->stop(['error' => 'readonly']);
});

```
