# Conditional field based on config value?

**URL:** <https://forum.getkirby.com/t/conditional-field-based-on-config-value/15711>\
**Category:** Questions\
**Tags:** v3\
**Created:** [September 19, 2019, 6:22am UTC](https://forum.getkirby.com/t/conditional-field-based-on-config-value/15711 "2019-09-19T06:22:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luxlogica](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/luxlogica/32/437_2.png) [@luxlogica](https://forum.getkirby.com/u/luxlogica)\
**Post date:** [September 19, 2019, 6:22am UTC](https://forum.getkirby.com/t/conditional-field-based-on-config-value/15711/1 "2019-09-19T06:22:02Z")

</div>

Hi all!

Is it possible to have a field be shown in the Panel, only when there is/isn’t a set value in the config file? Example: the field should show only if there is no ‘myplugin.default’ value in config.

---

<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:** [September 19, 2019, 7:36am UTC](https://forum.getkirby.com/t/conditional-field-based-on-config-value/15711/2 "2019-09-19T07:36:59Z")

</div>

Nope, that is not possible, unless you create a custom field.

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [September 19, 2019, 7:41am UTC](https://forum.getkirby.com/t/conditional-field-based-on-config-value/15711/3 "2019-09-19T07:41:47Z")

</div>

Hmm interesting one. I don’t think you can without making a custom field. However there is a plugin out there that adds extra classes to all the panel elements, with a little creative thinking you might be able to use that idea to get the same effect.

I’m thinking if you make a small plugin that throws a class on the panel body element based on the config value, then you can target the field in question through that class. It’s a little hacky and I don’t know what the side effects might be (off the top of my head if this is a required field and you hide it, you probably wont be able to save the page), but might just work 🙂

Making a custom field that extends all the built in fields properly to add the feature is the way to go though.

---

<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:** [September 19, 2019, 7:46am UTC](https://forum.getkirby.com/t/conditional-field-based-on-config-value/15711/4 "2019-09-19T07:46:09Z")

</div>

> [@jimbobrjames](#):
>
> (off the top of my head if this is a required field and you hide it, you probably wont be able to save the page),

That is generally a problem when using conditional fields: [Conditional fields: allow `required` · Issue #234 · getkirby/ideas · GitHub](https://github.com/getkirby/ideas/issues/234)
