# Conditional validator

**URL:** <https://forum.getkirby.com/t/conditional-validator/23064>\
**Category:** Questions\
**Tags:** v3\
**Created:** [August 5, 2021, 12:30pm UTC](https://forum.getkirby.com/t/conditional-validator/23064 "2021-08-05T12:30:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mantas\_G](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mantas_g/32/10787_2.png) [@Mantas\_G](https://forum.getkirby.com/u/Mantas_G)\
**Post date:** [August 5, 2021, 12:30pm UTC](https://forum.getkirby.com/t/conditional-validator/23064/1 "2021-08-05T12:30:01Z")

</div>

I have situation, where field is required, if “one” or “two” radio button value is selected, and optional, if “three” or “four” is selected. Is there any way to control “required” attribute for field based on another field value in blueprint.

I’m thinking about workaround: I can add 4 conditional fields (with “when”) per each (I have 3 fields like this, so 3\*4=12 additional fields in total), and always update original value based on criteria in “after update” hook. Is there any easier way?

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [August 5, 2021, 1:40pm UTC](https://forum.getkirby.com/t/conditional-validator/23064/2 "2021-08-05T13:40:48Z")

</div>

As far as I know, it is not possible to set the `required` attribute conditionally, because at the time you set the value in the first field, the frontend doesn’t know anything about your conditions in the backend.

---

<div class="post-metadata">

**Author:** ![Mantas\_G](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mantas_g/32/10787_2.png) [@Mantas\_G](https://forum.getkirby.com/u/Mantas_G)\
**Post date:** [September 14, 2021, 9:33am UTC](https://forum.getkirby.com/t/conditional-validator/23064/3 "2021-09-14T09:33:20Z")

</div>

Solution is: I created many field with when field. I ended up with 50 “fake” fields in blueprint.
