Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

How to use a drop down menu for navigation?


Go to End


5 Posts   3668 Views

Avatar
SilverRay

Community Member, 167 Posts

15 December 2007 at 8:37pm

Suppose I want to use a drop down menu for navigation, like so:

<form action="???" method="post" name="StateSelect">
<select class="dropdown" name="location" size="1">

<% control Menu(3) %>
<option value="$Link">$MenuTitle</option>
<% end_control %>

</select>
<input class="submitbutton" type="submit" value="Find" name="GoState" />
</form>

Then what would be the 'action' to put in?

Thanks,
- Ray.

Avatar
Fuzz10

Community Member, 791 Posts

16 December 2007 at 12:55am

Hi , a navigation dropdown will not work like that... It needs a bit more. ;-)

Check out http://www.alistapart.com/articles/dropdowns/ for an easy and accessible example.

Good luck !

Avatar
SilverRay

Community Member, 167 Posts

16 December 2007 at 1:58am

Thanks for your reply!

I'm not looking for a css based menu, but really a drop down (as used in a form... but use it for a certain type of navigation)... not possible to populate a drop down like that with links, with SS? I know I can put in link names with a control, but what would the post-action be? If I made myself clear that is ;)

- Ray

Avatar
Fuzz10

Community Member, 791 Posts

16 December 2007 at 2:19am

You need a bit of script to open the selected URL.

Check out this page :
http://www.cs.tut.fi/~jkorpela/forms/navmenu.html

Avatar
SilverRay

Community Member, 167 Posts

16 December 2007 at 2:38am

Right, I used to build drop down menus with server side scripting, but using SS that would be a little different I guess. I thought there would be a custom control built-in for this, but I cannot find it. Then I was thinking of making a function, similar to the one in the tutorial about showing browser polls, but hey, I'm not that good (yet ;)

Maybe I have to decide on making it css-based though, downside is that it seems to pose problems with IE6...

Thanks again,
- Ray.