# Build options of select field by value of another field in the same page

**URL:** <https://forum.getkirby.com/t/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424>\
**Category:** Questions\
**Tags:** v2\
**Created:** [May 16, 2018, 4:18pm UTC](https://forum.getkirby.com/t/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424 "2018-05-16T16:18:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![designbuedchen](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/designbuedchen/32/3137_2.png) [@designbuedchen](https://forum.getkirby.com/u/designbuedchen)\
**Post date:** [May 16, 2018, 4:18pm UTC](https://forum.getkirby.com/t/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424/1 "2018-05-16T16:18:58Z")

</div>

I’m just to dumb to get the solution. Please help me.

I have several pages with subpages:

```
PAGE A
    SUBPAGE A1
    SUBPAGE A2
    SUBPAGE A3

PAGE B
    SUBPAGE B1
    SUBPAGE B2
    SUBPAGE B3

PAGE C
    SUBPAGE C1
    SUBPAGE C2
    SUBPAGE C3

```

Now I have a slider and I want to link the slider elements based on two fields: PAGE and SUBPAGE. So in my blueprint I will integrate two select fields and for the first one (to select PAGE A, B or C) I’m using it like this:

```
anchor_rubrik:
	label: Anker Rubrik
	type: select
	default: ''
	options: query
	query:
		page: /
		fetch: visibleChildren
		value: '{{slug}}'
		text: '{{title}}'

```

Then I want my options in the second field based on the value of the first field. So when I chose PAGE B for the field “anchor\_rubrik” I want the options [SUBPAGE B1, SUBPAGE B2, SUBPAGE B3] for my field “anchor\_single”.

How can I achieve this?

Thanks in advance for the help!

---

<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 16, 2018, 5:17pm UTC](https://forum.getkirby.com/t/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424/2 "2018-05-16T17:17:18Z")

</div>

You need a custom field with some JS that listens on the first field and then fetches and injects the options into the second field.

---

<div class="post-metadata">

**Author:** ![designbuedchen](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/designbuedchen/32/3137_2.png) [@designbuedchen](https://forum.getkirby.com/u/designbuedchen)\
**Post date:** [May 16, 2018, 5:20pm UTC](https://forum.getkirby.com/t/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424/3 "2018-05-16T17:20:59Z")

</div>

Is there any example out there for inspiration? 😉

---

<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 16, 2018, 5:24pm UTC](https://forum.getkirby.com/t/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424/4 "2018-05-16T17:24:17Z")

</div>

Maybe you can find something [here](https://github.com/jenstornell/kirby-plugins/issues), I can’t recall a particular plugin at the moment…

---

<div class="post-metadata">

**Author:** ![designbuedchen](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/designbuedchen/32/3137_2.png) [@designbuedchen](https://forum.getkirby.com/u/designbuedchen)\
**Post date:** [May 16, 2018, 7:25pm UTC](https://forum.getkirby.com/t/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424/5 "2018-05-16T19:25:09Z")

</div>

is there a way to do it without JS, maybe after saving the document you will get all the options?

---

<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 16, 2018, 7:29pm UTC](https://forum.getkirby.com/t/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424/6 "2018-05-16T19:29:34Z")

</div>

That should be possible, if your field queries a field on the same page, but probably isn’t very intuitive if the user has to save the page before being able to select another field option.

See [https://getkirby.com/docs/cheatsheet/panel-fields/select](https://getkirby.com/docs/cheatsheet/panel-fields/select), option from other field.

---

<div class="post-metadata">

**Author:** ![designbuedchen](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/designbuedchen/32/3137_2.png) [@designbuedchen](https://forum.getkirby.com/u/designbuedchen)\
**Post date:** [May 16, 2018, 7:55pm UTC](https://forum.getkirby.com/t/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424/7 "2018-05-16T19:55:04Z")

</div>

I’m doing it now like this. Then I can see in the list what is the URL tree of the file. It works and that’s okay for me now.

Thanks anyway for your help!!!

```
link:
	label: Link
	type: select
	default: ''
	options: query
	query:
		page: /
		fetch: visibleGrandchildren
		value: '{{slug}}'
		text: '{{uri}}'
```

---

<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 16, 2018, 7:57pm UTC](https://forum.getkirby.com/t/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424/8 "2018-05-16T19:57:28Z")

</div>

Yep, that is a lot less overhead, as long as the list doesn’t get too long.

---

<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/build-options-of-select-field-by-value-of-another-field-in-the-same-page/10424/9 "2025-02-06T17:28:14Z")

</div>


