# Conditional field depending on status of files section

**URL:** <https://forum.getkirby.com/t/conditional-field-depending-on-status-of-files-section/17718>\
**Category:** Questions\
**Tags:** v3\
**Created:** [March 29, 2020, 4:22pm UTC](https://forum.getkirby.com/t/conditional-field-depending-on-status-of-files-section/17718 "2020-03-29T16:22:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![trych](https://avatars.discourse-cdn.com/v4/letter/t/5e9695/32.png) [@trych](https://forum.getkirby.com/u/trych)\
**Post date:** [March 29, 2020, 4:22pm UTC](https://forum.getkirby.com/t/conditional-field-depending-on-status-of-files-section/17718/1 "2020-03-29T16:22:05Z")

</div>

Hi there,

I want to make a panel field conditional with the `when` property. Generally, I understand that the syntax is

```yaml
when:
  myField: myValue

```

However, in my case I want to make the field appear whenever there are images in a gallery files section. Is there a simple way to do that?

Thanks!

---

<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:** [March 29, 2020, 4:32pm UTC](https://forum.getkirby.com/t/conditional-field-depending-on-status-of-files-section/17718/2 "2020-03-29T16:32:24Z")

</div>

> [@trych](#):
>
> Is there a simple way to do that?

No, there is no way to achieve this (by default).

Idea for a workaround worth testing: When a file is uploaded, update the page with a hidden field (using a `file.create:after` hook) and use this field value to determine if the other field should be shown. Don’t know if this works without refreshing the page, though.

You would have to update the field value when files are deleted.

---

<div class="post-metadata">

**Author:** ![trych](https://avatars.discourse-cdn.com/v4/letter/t/5e9695/32.png) [@trych](https://forum.getkirby.com/u/trych)\
**Post date:** [March 29, 2020, 6:46pm UTC](https://forum.getkirby.com/t/conditional-field-depending-on-status-of-files-section/17718/3 "2020-03-29T18:46:30Z")

</div>

Thanks, I will look into this. If this requires refreshing the page it would be not usable for me.

I might open a feature request for this on GitHub, as I think it might make sense to give the `when` property some extra power (also it would be useful to allow triggering when a certain field does not have a certain value).

---

<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:** [March 29, 2020, 7:17pm UTC](https://forum.getkirby.com/t/conditional-field-depending-on-status-of-files-section/17718/4 "2020-03-29T19:17:13Z")

</div>

> [@trych](#):
>
> I might open a feature request for this on GitHub, as I think it might make sense to give the `when` property some extra power

There are already multiple feature request for conditional fields! Please check them out before you open yet another one.
