Placing Links in a Drop-Down Box

General ShopSite user discussion

Placing Links in a Drop-Down Box

Postby MarkB » Sat Sep 09, 2006 1:40 pm

This may not be a ShopSite specific issue, but maybe someone has already done this and can provide a pointer.

I have a large number of links (categories) on my site and want to place them all in a drop-down box. I've successfully created the drop-down box, but not sure how to actually select a category and have the new page open.

In my custom product template I have this setup to create my box:

[-- DEFINE LINK_TO_PAGE --]
<option value="[-- OUTPUT_DIRECTORY_URL --]/[-- Page.FileName --]">[-- PAGE.LinkName --]
[-- END_DEFINE LINK_TO_PAGE --]

Then I inserted this code where I want the box to appear:

<FORM>
Select Category <select name="category" size="1">
[-- LOOP LINKS --]
[-- LINK --]
[-- END_LOOP LINKS --]
</select>
</FORM>

The above code doesn't include a "go" button yet or "action=" or "method=post" section within the form yet, but I'd like to know if I can do a straight re-direct to load the new page? Or do I need to write a simple CGI script to do this?

Thank-you,

Mark
MarkB
 
Posts: 31
Joined: Sat Sep 09, 2006 1:24 pm

Postby robm » Sat Sep 09, 2006 2:45 pm

Try something like:

Code: Select all
<form name="jumpurl">
<select name="category"
 OnChange="location.href=jumpurl.category.options[selectedIndex].value">
     <option selected>Please Select...
     <option value="http://www.your_domain.com/page1.html">page1
     <option value="http://www.your_domain.com/page2.html">page2
     <option value="http://www.your_domain.com/page3.html">page3
</select>
</form>
robm
 
Posts: 463
Joined: Fri Aug 04, 2006 5:46 pm
Location: Connecticut

Postby MarkB » Sat Sep 09, 2006 3:07 pm

Thank-you very much! Works great!

I knew there had to be a simple solution ;-)

Mark
MarkB
 
Posts: 31
Joined: Sat Sep 09, 2006 1:24 pm


Return to User Forum

Who is online

Users browsing this forum: No registered users and 126 guests