# Structure field: disable add/delete row only?

**URL:** <https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391>\
**Category:** Questions\
**Tags:** v3\
**Created:** [May 27, 2019, 2:44pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391 "2019-05-27T14:44:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gillesvauvarin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gillesvauvarin/32/2351_2.png) [@gillesvauvarin](https://forum.getkirby.com/u/gillesvauvarin)\
**Post date:** [May 27, 2019, 2:44pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391/1 "2019-05-27T14:44:24Z")

</div>

Hi,

In a specific type of page, I programmatically populate a structure field regarding a another structure field defined elsewhere in the panel.

I would like that users with role “A” were able to edit fields from this structure field but unable to add or delete a row in this structure field.

Is there a way to achieve this?  
Thanks for your advises 🙂

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 27, 2019, 2:57pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391/2 "2019-05-27T14:57:10Z")

</div>

Certainly not out of the box, at least not in a nice way. We don’t even have editing options per role on the field level, anyway.

You can definitely set a max limit for the number of entries. And you could probably use a pre update hook to check if the number of entries is still the same as before, but this only kicks in after the user has already tried to remove an entry. It would work to prevent deleting entries, but is not very user friendly. If you combine it with some info or help text, you can at least warn the user to not even try and delete stuff. If they do it anyway and fail, too bad.

---

<div class="post-metadata">

**Author:** ![gillesvauvarin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gillesvauvarin/32/2351_2.png) [@gillesvauvarin](https://forum.getkirby.com/u/gillesvauvarin)\
**Post date:** [May 27, 2019, 3:03pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391/3 "2019-05-27T15:03:20Z")

</div>

Maybe if I replace structure field rows by sub-pages, I probably could achieve something similar with the new role permissions settings developed in the 3.2 Kirby version 🤔

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 27, 2019, 3:04pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391/4 "2019-05-27T15:04:26Z")

</div>

If you use subpages, you can prevent deletion, anyway.

---

<div class="post-metadata">

**Author:** ![gillesvauvarin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gillesvauvarin/32/2351_2.png) [@gillesvauvarin](https://forum.getkirby.com/u/gillesvauvarin)\
**Post date:** [May 27, 2019, 3:10pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391/5 "2019-05-27T15:10:47Z")

</div>

Yes but as I use hook to delete/add rows in the structure field if the admin user modified the “original” structure field from which the second structure field is populated, I can’t set page delete to false.

But with Kirby 3.2 I will be able to set delete page to false for role “A” and delete page to true for admin, so my hook will do the job if the admin user change number of row in the “original” structure field I’m right?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 27, 2019, 3:14pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391/6 "2019-05-27T15:14:03Z")

</div>

> [@gillesvauvarin](#):
>
> so my hook will do the job if the admin user change number of row in the “original” structure field I’m right?

We’ll see. We need an option to override blueprint settings programmatically, hope that will come in 3.2 as well.

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [July 11, 2019, 4:07pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391/7 "2019-07-11T16:07:04Z")

</div>

I found a feature that `max: true` by coincidence 🙂  
This provide disable to create new item. But to disable delete `min: true` not working ☹  
I think more management features should come to structure field.  
Of course it doesn’t allow adding items when max is true

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [July 11, 2019, 4:25pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391/8 "2019-07-11T16:25:54Z")

</div>

@ahmetbora Excactly, that’s what I already mentioned above in my first post…

---

<div class="post-metadata">

**Author:** ![gork](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gork/32/8110_2.png) [@gork](https://forum.getkirby.com/u/gork)\
**Post date:** [February 5, 2020, 8:54pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391/9 "2020-02-05T20:54:20Z")

</div>

> [@texnixe](#):
>
> We’ll see. We need an option to override blueprint settings programmatically, hope that will come in 3.2 as well.

I am looking for the same feature:  
I would like to have a structure (or any type of field) that has 4 initial values (`text` used as keys) where the only a textarea can be changed  
The 4 default items should not be deleted, nor should there be any new entered.  
Using `max: 4` works, but `min: 4` leads to have structure-rows deleted and only an error show (red border)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 5, 2020, 9:31pm UTC](https://forum.getkirby.com/t/structure-field-disable-add-delete-row-only/14391/10 "2020-02-05T21:31:21Z")

</div>

@gork I think at the moment you have no other choice than either using four separate fields or try to tinker with a copy of the structure field (remove the `remove` button, for example). Or create a custom field.

Or simply hide the `remove` button via CSs.
