# How to redirect when click a drop-down list entry? Used as navigation in the top bar

**URL:** <https://discourse.cakephp.org/t/how-to-redirect-when-click-a-drop-down-list-entry-used-as-navigation-in-the-top-bar/1615>\
**Category:** Need Help\
**Created:** [November 27, 2016, 4:45am UTC](https://discourse.cakephp.org/t/how-to-redirect-when-click-a-drop-down-list-entry-used-as-navigation-in-the-top-bar/1615 "2016-11-27T04:45:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![favoryoung](https://avatars.discourse-cdn.com/v4/letter/f/ed655f/32.png) [@favoryoung](https://discourse.cakephp.org/u/favoryoung)\
**Post date:** [November 27, 2016, 4:45am UTC](https://discourse.cakephp.org/t/how-to-redirect-when-click-a-drop-down-list-entry-used-as-navigation-in-the-top-bar/1615/1 "2016-11-27T04:45:26Z")

</div>

![](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/1X/e28d46b33a0d2dd2bedfc90312b8a2837f168bbf.png)

Just like the navigation bar in the official site of CakePHP.  
All I know to do this is creating a form with a select list, adding a submit button then redirecting when submit. But can we just redirect when click the list entry?

---

<div class="post-metadata">

**Author:** ![chief-cook](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/chief-cook/32/479_2.png) [@chief-cook](https://discourse.cakephp.org/u/chief-cook)\
**Post date:** [November 27, 2016, 11:04pm UTC](https://discourse.cakephp.org/t/how-to-redirect-when-click-a-drop-down-list-entry-used-as-navigation-in-the-top-bar/1615/2 "2016-11-27T23:04:31Z")

</div>

Hey!  
If you look at the elements of the CakePHP website you will see that this is an unordered list of links ( “a”-elements). So this is one way to make redirections happen.

You could also use a form for this having all the list elements as buttons with a particular id which would be then the redirection variable.

Also you could redirect using JavaScript/JQuery here.

Not sure if there are other ways to do that.

Hope it helps, Rich

---

<div class="post-metadata">

**Author:** ![favoryoung](https://avatars.discourse-cdn.com/v4/letter/f/ed655f/32.png) [@favoryoung](https://discourse.cakephp.org/u/favoryoung)\
**Post date:** [November 28, 2016, 3:07am UTC](https://discourse.cakephp.org/t/how-to-redirect-when-click-a-drop-down-list-entry-used-as-navigation-in-the-top-bar/1615/3 "2016-11-28T03:07:03Z")

</div>

Thank you very much for reply, Rich!  
I’ll look into it later. Through your reply I understand the HTML machanism here. And now I’m looking for an appproach to accomplish this feature using functions within CakePHP framwork. Hope I can succeed.  
Thank you again!

---

<div class="post-metadata">

**Author:** ![chief-cook](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/chief-cook/32/479_2.png) [@chief-cook](https://discourse.cakephp.org/u/chief-cook)\
**Post date:** [November 29, 2016, 9:51pm UTC](https://discourse.cakephp.org/t/how-to-redirect-when-click-a-drop-down-list-entry-used-as-navigation-in-the-top-bar/1615/4 "2016-11-29T21:51:41Z")

</div>

Happy to help you!  
Let me know if something worked for you. If not you could still post some example code to have a better picture of what not worked. Keep up coding! 🙂
