# How can I link a dropdown user input element to a dynamic page?

**URL:** <https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [August 5, 2018, 12:36pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481 "2018-08-05T12:36:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![chickenmangoblog](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chickenmangoblog/32/3218_2.png) [@chickenmangoblog](https://forum.wixstudio.com/u/chickenmangoblog)\
**Post date:** [August 5, 2018, 12:36pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/1 "2018-08-05T12:36:03Z")

</div>

Hi guys,  
I want to connect a dropdown user input element to a dynamic page. So, when users click on an item of the dropdown list, they are redirected to the related dynamic page. I’m gonna explain it better:

**1-** I create a page with a dataset connected to the collection which has my relevant dynamic page connected;  
**2-** I insert a dropdown user uinput element (pic. 1);

![](https://us1.discourse-cdn.com/wix/original/3X/b/3/b32f0ea73c75d8e3d23a78c756daab1b7801f2a8.png)

**3-** I connect #dropdown1 with the collection so that all the items displayed correspond to a column (in this case, the column name’s “Heading 1”. Pic. 2);

 ![](https://us1.discourse-cdn.com/wix/original/3X/c/9/c9c36cb1975035c32b4e20a2ae098f3445fcde6d.png)

**4-** The preview effect is this: pic. 3. Maybe someone can also explain to me why I see the “failed to fetch” error in the console?

 ![](https://us1.discourse-cdn.com/wix/original/3X/7/7/7784bd5145d015ec9c332aee7082eec88bf30008.png)

**5-** Now I want that the user, once he clicks on a dropdown’s item, “e-commerce” for example, goes to its related dynamic page (pic. 4).

![](https://us1.discourse-cdn.com/wix/original/3X/f/6/f6033dca7d91ddf203bc1306ac1206bb99937492.jpeg)

**So guys how can I do this? Please, if you know how to help me, write exactly step by step what I have to do.**

Thanks for your time and patience!

---

<div class="post-metadata">

**Author:** ![tiaan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tiaan/32/896_2.png) [@tiaan](https://forum.wixstudio.com/u/tiaan)\
**Post date:** [August 6, 2018, 2:42pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/2 "2018-08-06T14:42:13Z")

</div>

@chickenmangoblog

I’d suggest opening the properties panel under the tools panel in the header, then add an onChange to the dropdown. Underneath that onChange, add the following code:

```javascript
wixLocation.to(`/Digital-marketing-courses/${$w("#dropdown1").value}`);

```

oh, and remember to add this to your page code right at the top:

```javascript
import wixLocation from 'wix-location';

```

Best of luck!  
Tiaan

---

<div class="post-metadata">

**Author:** ![chickenmangoblog](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chickenmangoblog/32/3218_2.png) [@chickenmangoblog](https://forum.wixstudio.com/u/chickenmangoblog)\
**Post date:** [August 6, 2018, 3:51pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/3 "2018-08-06T15:51:14Z")

</div>

Hi Tiaan (@tiaan),  
Thank you for the reply.

So, I inserted the code as you told me: pic. 1;

 ![](https://us1.discourse-cdn.com/wix/original/3X/a/1/a1adb5cec0b5d54af363a39120a5d9785e265f80.jpeg)

Then I previewed the website, selected the item I wanted from the dropdown (pic. 2):

![](https://us1.discourse-cdn.com/wix/original/3X/5/e/5e618aa8f6c91e9bdaf5bfec8f7ed17c7013eeb9.png)

Then, I clicked on the item, but it didn’t redirect me to its related dynamic page (pic. 3). It just showed the element selected without doing any action.

![](https://us1.discourse-cdn.com/wix/original/3X/c/1/c18587f96ae67c2410e20ff9b1602260b7931f98.png)  
**What’s wrong?**

Thank you in advance for your support.

---

<div class="post-metadata">

**Author:** ![tiaan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tiaan/32/896_2.png) [@tiaan](https://forum.wixstudio.com/u/tiaan)\
**Post date:** [August 6, 2018, 4:12pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/4 "2018-08-06T16:12:57Z")

</div>

@chickenmangoblog

Open the dynamic page in the editor, then copy from the page info the page url over for the ‘Digital-marketing-courses’ section - yours should look something like this: ‘Digital-marketing-courses/{title}’

I think my spelling might just not be exactly what your url is…

In this screenshot it’s ‘Members/{ID}’

 ![](https://us1.discourse-cdn.com/wix/original/3X/4/0/409244ece94a7a93a8ad58928fea47374db40df8.png)

---

<div class="post-metadata">

**Author:** ![chickenmangoblog](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chickenmangoblog/32/3218_2.png) [@chickenmangoblog](https://forum.wixstudio.com/u/chickenmangoblog)\
**Post date:** [August 6, 2018, 8:11pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/5 "2018-08-06T20:11:55Z")

</div>

@Tiaan,  
Thank you very much for the support, you were right. However, **now I view a different error message**.

I corrected the url in the code (pic. 1):

 ![](https://us1.discourse-cdn.com/wix/original/3X/7/c/7c38d3d3946db03891604809bcff3ede3d210f98.png)

And, as you see from pic. 2, the url is correct:

 ![](https://us1.discourse-cdn.com/wix/original/3X/d/6/d66c4645f0e4564f380dca8236f186bbfb6de04c.png)

But once I preview the site, I view this error message (pic. 3):

 ![](https://us1.discourse-cdn.com/wix/original/3X/b/1/b1fa5ee0534709bb80e1935237f1b9460d717b60.png)

**Another incorrect information is the url retrieved showed by the error message**. The correct url for the dynamic page doesn’t have the final folder (e.g. “INNOVATION” as showed on pic. 3). As you can see from pic. 4 the dynamic pages urls are the following:

![](https://us1.discourse-cdn.com/wix/original/3X/3/b/3b591bd753554066ce2de5bbb5d736b16cc8dea1.png)

On the live site instead, it still doesn’t happen anything. Like before. Is it only me who is experiencing this issue?

**Do you know what happens?**

---

<div class="post-metadata">

**Author:** ![tiaan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tiaan/32/896_2.png) [@tiaan](https://forum.wixstudio.com/u/tiaan)\
**Post date:** [August 7, 2018, 7:11am UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/6 "2018-08-07T07:11:31Z")

</div>

@chickenmangoblog

Yes, you need to remove the ‘/{Title}’ from the coded url - this is replaced by the dropdown value. Then it should work!

Like so:

```javascript
wixLocation.to(`/digital-marketing-courses/${$w("#dropdown1").value}`);

```

---

<div class="post-metadata">

**Author:** ![chickenmangoblog](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chickenmangoblog/32/3218_2.png) [@chickenmangoblog](https://forum.wixstudio.com/u/chickenmangoblog)\
**Post date:** [August 7, 2018, 12:24pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/7 "2018-08-07T12:24:07Z")

</div>

@Tiaan  
WOW! Great Tiaan! It works!

![](https://us1.discourse-cdn.com/wix/original/3X/b/d/bd2705a6ba48c2b9562f27fabe2be926be65ff05.gif)

Thank you!

---

<div class="post-metadata">

**Author:** ![tiaan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tiaan/32/896_2.png) [@tiaan](https://forum.wixstudio.com/u/tiaan)\
**Post date:** [August 7, 2018, 12:26pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/8 "2018-08-07T12:26:11Z")

</div>

Awesome! Glad I could help…

---

<div class="post-metadata">

**Author:** ![chickenmangoblog](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chickenmangoblog/32/3218_2.png) [@chickenmangoblog](https://forum.wixstudio.com/u/chickenmangoblog)\
**Post date:** [August 7, 2018, 5:22pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/9 "2018-08-07T17:22:56Z")

</div>

@Tiaan,  
I’m really sorry to bother you again, but it seems your code works only for items that are a single word.

The code works only for the item “e-commerce” (which is the only item I tried to click on before), but if you try to click on the others which are formed by more than one word you view an error.

On pic. 1 there are the dropdown’s items (I remember you that they are also elements of a column in a collection):

![](https://us1.discourse-cdn.com/wix/original/3X/9/8/984869a907be508794f6991ff1045a969a0e81e3.png)

Now, see the error if I click on an item which is formed more than one word (pic.2):

 ![](https://us1.discourse-cdn.com/wix/original/3X/3/c/3caa95b643812e0e13f3276496a3f2e867abde38.png)

**As you can see, the url is not complete.** Why does it cut the url? Because, if it uses the items of the dropdown, it should add a “-” to connect words, otherwise it should use the actual links of my dynamic page…

---

<div class="post-metadata">

**Author:** ![tiaan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tiaan/32/896_2.png) [@tiaan](https://forum.wixstudio.com/u/tiaan)\
**Post date:** [August 7, 2018, 5:29pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/10 "2018-08-07T17:29:08Z")

</div>

try adding a ‘.replace(" “,”-")’ to your code like this:

```javascript
wixLocation.to(`/digital-marketing-courses/${$w("#dropdown1").value.replace(" ","-")}`);

```

should work…

---

<div class="post-metadata">

**Author:** ![chickenmangoblog](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chickenmangoblog/32/3218_2.png) [@chickenmangoblog](https://forum.wixstudio.com/u/chickenmangoblog)\
**Post date:** [August 7, 2018, 5:56pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/11 "2018-08-07T17:56:39Z")

</div>

@Tiaan,  
Super thanks! if you were in Italy I would have offered you a Spritz! haha

Thank you again!

---

<div class="post-metadata">

**Author:** ![chickenmangoblog](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chickenmangoblog/32/3218_2.png) [@chickenmangoblog](https://forum.wixstudio.com/u/chickenmangoblog)\
**Post date:** [August 11, 2018, 12:22pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/12 "2018-08-11T12:22:12Z")

</div>

@tiaan  
Hi Tiaan how are you? I’m following your posts, they are really inspiring!

Regarding these dropdown clickable elements, I found another issue. The dropdown creates a link only if an item is formed up to two words.

For example (pic. 1):

 ![](https://us1.discourse-cdn.com/wix/original/3X/0/1/01a6ccca5b4c042e4da828495a5b3dc042eb7d18.png)

As you can see the whole item is “INNOVATION AND PRODUCTS”, but it is cut from “AND”. So, for this reason, all the items’ links formed by more than two words don’t work. **How can I solve this issue?** I have items formed up to three words.

---

<div class="post-metadata">

**Author:** ![tiaan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tiaan/32/896_2.png) [@tiaan](https://forum.wixstudio.com/u/tiaan)\
**Post date:** [August 12, 2018, 1:21pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/13 "2018-08-12T13:21:10Z")

</div>

@chickenmangoblog

Thanks for the compliment!

This should work… Are there perhaps tow spaces or another character between ‘AND PRODUCTS’?

---

<div class="post-metadata">

**Author:** ![chickenmangoblog](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chickenmangoblog/32/3218_2.png) [@chickenmangoblog](https://forum.wixstudio.com/u/chickenmangoblog)\
**Post date:** [August 12, 2018, 1:49pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/14 "2018-08-12T13:49:16Z")

</div>

@tiaan

Supposing you meant “two spaces”, I confirm: there is just only one space…

---

<div class="post-metadata">

**Author:** ![tiaan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tiaan/32/896_2.png) [@tiaan](https://forum.wixstudio.com/u/tiaan)\
**Post date:** [August 12, 2018, 2:05pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/15 "2018-08-12T14:05:04Z")

</div>

Hmm…, perhaps try stringing to .replaces after one another like this…

```javascript
courses/${$w("#dropdown1").value.replace(" ","-").replace(" ","-")}`);

```

---

<div class="post-metadata">

**Author:** ![chickenmangoblog](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chickenmangoblog/32/3218_2.png) [@chickenmangoblog](https://forum.wixstudio.com/u/chickenmangoblog)\
**Post date:** [August 12, 2018, 2:13pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/16 "2018-08-12T14:13:36Z")

</div>

@tiaan

Yeah you’re right, I’ve just published and now it seems working. Such a puzzle!

Thank you again!

---

<div class="post-metadata">

**Author:** ![tiaan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tiaan/32/896_2.png) [@tiaan](https://forum.wixstudio.com/u/tiaan)\
**Post date:** [August 12, 2018, 2:16pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/17 "2018-08-12T14:16:42Z")

</div>

Yeah, sometimes trial and erros is the only way with these things…

Happy it worked!

---

<div class="post-metadata">

**Author:** ![stas36](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/stas36/32/10012_2.png) [@stas36](https://forum.wixstudio.com/u/stas36)\
**Post date:** [June 20, 2019, 6:28pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/18 "2019-06-20T18:28:02Z")

</div>

Ok, I’ll go launch some reusable rockets made of paper and wood, it would be easier

---

<div class="post-metadata">

**Author:** ![admin12285](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/admin12285/32/16780_2.png) [@admin12285](https://forum.wixstudio.com/u/admin12285)\
**Post date:** [January 30, 2020, 6:57am UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/19 "2020-01-30T06:57:22Z")

</div>

Hi  
I have followed this post for the way to connect a dynamic page from drop-down list. But a error message when connecting to the page. see below.

Can anyone help with this issue?

 ![](https://us1.discourse-cdn.com/wix/original/3X/3/d/3d908c2979163d065b2edc0e76087f97b296de35.png)

 ![](https://us1.discourse-cdn.com/wix/original/3X/b/4/b4e3404a606e07974b0cfdd1de8755d66f080ffa.jpeg)

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [January 31, 2020, 3:21pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-dropdown-user-input-element-to-a-dynamic-page/20481/20 "2020-01-31T15:21:00Z")

</div>

Old post reappearing, closed.  
Please add a new forum post if help still needed.
