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);
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);
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:
Then I previewed the website, selected the item I wanted from the dropdown (pic. 2):
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.
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…
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:
On the live site instead, it still doesn’t happen anything. Like before. Is it only me who is experiencing this issue?
@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):
Now, see the error if I click on an item which is formed more than one word (pic.2):
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…
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.