# Button on a dynamic page, leading to another dynamic page

**URL:** <https://forum.wixstudio.com/t/button-on-a-dynamic-page-leading-to-another-dynamic-page/60164>\
**Category:** Ask the community\
**Tags:** code, wix-studio, question\
**Created:** [June 20, 2024, 9:39pm UTC](https://forum.wixstudio.com/t/button-on-a-dynamic-page-leading-to-another-dynamic-page/60164 "2024-06-20T21:39:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![misterwanderluster](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/misterwanderluster/32/13671_2.png) [@misterwanderluster](https://forum.wixstudio.com/u/misterwanderluster)\
**Post date:** [June 20, 2024, 9:39pm UTC](https://forum.wixstudio.com/t/button-on-a-dynamic-page-leading-to-another-dynamic-page/60164/1 "2024-06-20T21:39:26Z")

</div>

**Question:**  
I have a dynamic page with a dynamic dataset connected to a database called “Reservations”. One of the fields of this dataset is called “itinerary” and contains the ID (\_id) of one of the entries in another database called “Itineraries”. This Itineraries database also has a Dynamic page.

On the Reservations Dynamic Page I would like to create a button that links to the Itineraries Database page, and specifically to the Itineraries page that corresponds with the \_id in the “Itinerary” field in the Reservations Database.

I created a dataset connected to the Itineraries Database (dataset2) and that sets to submit and open the dynamic itineraries page. With help of the below code I tried to filter the dataset2 to only select the itinerary that has the ID in the reservations database but it doesn’t work.

```javascript
	$w("#dataset2").onReady(()=>{
		const itineraryid = $w("#dataset2").getCurrentItem()._id;		
		$w("#dynamicDataset").setFilter(wixData.filter().eq("itinerary",itineraryid));
	});

```

Anyone any idea how I can achieve what I’d like to achieve?

Thanks a lot!

**Product:**  
Wix Studio

---

<div class="post-metadata">

**Author:** ![anthony](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anthony/32/79536_2.png) [@anthony](https://forum.wixstudio.com/u/anthony)\
**Post date:** [June 24, 2024, 8:25pm UTC](https://forum.wixstudio.com/t/button-on-a-dynamic-page-leading-to-another-dynamic-page/60164/2 "2024-06-24T20:25:00Z")

</div>

What’s the data in the `itinerary` column. Is it just a string or a reference field or something else?

---

<div class="post-metadata">

**Author:** ![misterwanderluster](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/misterwanderluster/32/13671_2.png) [@misterwanderluster](https://forum.wixstudio.com/u/misterwanderluster)\
**Post date:** [June 24, 2024, 11:09pm UTC](https://forum.wixstudio.com/t/button-on-a-dynamic-page-leading-to-another-dynamic-page/60164/3 "2024-06-24T23:09:19Z")

</div>

Hi! It’s just a string 🙂

---

<div class="post-metadata">

**Author:** ![CMSblocks.com](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/cmsblocks.com/32/93515_2.png) [@CMSblocks.com](https://forum.wixstudio.com/u/CMSblocks.com)\
**Post date:** [June 25, 2024, 10:04am UTC](https://forum.wixstudio.com/t/button-on-a-dynamic-page-leading-to-another-dynamic-page/60164/4 "2024-06-25T10:04:41Z")

</div>

You can use a single reference field and connect the button to the link through the editor.

> **[CMS: About Reference Fields in Database Collections | Help Center | Wix.com](https://support.wix.com/en/article/cms-about-reference-fields-in-database-collections)**
>
> Note:Before continuing you may want to read About Database Collections.Reference fields let you link one collection with other collections. Specifically, a refe

---

<div class="post-metadata">

**Author:** ![misterwanderluster](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/misterwanderluster/32/13671_2.png) [@misterwanderluster](https://forum.wixstudio.com/u/misterwanderluster)\
**Post date:** [June 25, 2024, 10:56am UTC](https://forum.wixstudio.com/t/button-on-a-dynamic-page-leading-to-another-dynamic-page/60164/5 "2024-06-25T10:56:36Z")

</div>

That’s what I tried but the \_id field is not available in the editor so I think coding is the only way to achieve this.

---

<div class="post-metadata">

**Author:** ![CMSblocks.com](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/cmsblocks.com/32/93515_2.png) [@CMSblocks.com](https://forum.wixstudio.com/u/CMSblocks.com)\
**Post date:** [June 25, 2024, 11:00am UTC](https://forum.wixstudio.com/t/button-on-a-dynamic-page-leading-to-another-dynamic-page/60164/6 "2024-06-25T11:00:22Z")

</div>

What doyou mean \_id field is not available in the editor does not appear.  
If you used a **single reference** field there should be access into the fields of the item
