# Make a field required only if an other has been filled in

**URL:** <https://forum.getkirby.com/t/make-a-field-required-only-if-an-other-has-been-filled-in/10053>\
**Category:** Questions\
**Tags:** v2\
**Created:** [March 21, 2018, 10:58pm UTC](https://forum.getkirby.com/t/make-a-field-required-only-if-an-other-has-been-filled-in/10053 "2018-03-21T22:58:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rrr](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@Rrr](https://forum.getkirby.com/u/Rrr)\
**Post date:** [March 21, 2018, 10:58pm UTC](https://forum.getkirby.com/t/make-a-field-required-only-if-an-other-has-been-filled-in/10053/1 "2018-03-21T22:58:22Z")

</div>

Hi there,  
I’m having trouble finding the best way to do this.  
I have 3 not required text fields in my blueprint and I would like one of the fields to become required if an other one has content in it.

Example

Field 1: Caption  
Field 2: Caption Link  
Field 3: Caption Link Title

Let’s say Field 2 gets [www.google.com](http://www.google.com) as input, then Field 3 should be required, so the user must fill a title for the URL from field 2.

What would be the best way to do something like this?

The output I’m chasing is:  
`Field 1 + <a href="Field 2">Field 3</a>`

---

<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 22, 2018, 7:49am UTC](https://forum.getkirby.com/t/make-a-field-required-only-if-an-other-has-been-filled-in/10053/2 "2018-03-22T07:49:42Z")

</div>

Hm, good question. I think you need a custom field for this that checks if the Caption link is filled in and then adds a required attribute to the title.

I first thought you could use the toggle field, but that doesn’t work with required fields either.

However, I’d probably use a help text (maybe in combination with the toggle field to stress it a bit more that these fields belong together) and then use a fallback text in case the user didn’t fill in the field.

---

<div class="post-metadata">

**Author:** ![Rrr](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@Rrr](https://forum.getkirby.com/u/Rrr)\
**Post date:** [March 26, 2018, 7:25am UTC](https://forum.getkirby.com/t/make-a-field-required-only-if-an-other-has-been-filled-in/10053/3 "2018-03-26T07:25:37Z")

</div>

I went for the help instruction, also made it that it wouldn’t render unless there’s a title filled in.

Was looking at Statamic fieldsets and they have this cool thing:

```
myFieldName:
    type: text
    show_when:
      an_other_field_name: not null

```

[https://docs.statamic.com/fieldsets#conditional-fields](https://docs.statamic.com/fieldsets#conditional-fields)

---

<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 26, 2018, 7:39am UTC](https://forum.getkirby.com/t/make-a-field-required-only-if-an-other-has-been-filled-in/10053/4 "2018-03-26T07:39:57Z")

</div>

As I said, you could create a custom field.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:28pm UTC](https://forum.getkirby.com/t/make-a-field-required-only-if-an-other-has-been-filled-in/10053/5 "2025-02-06T17:28:35Z")

</div>

Archived on February 6, 2025, 5:28pm UTC


