PDA

View Full Version : chainedmenu without "Go" button



EricD
05-24-2007, 02:20 AM
1) Script Title:
Chined Select Menu
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex1/chainedmenu/index.htm
3) Describe problem:
I'm using chained menus (which works great) but the client doesn't like the Go button and wants to go to the new page on the last selection. I tried copying the button's onclick() info into the last select as an onChange() function but nothing happens.
TIA, Eric

EricD
05-24-2007, 09:39 PM
I got it to work by using ChainedSelect instead of ChainedMenu. I set the openLink function to the last menu's onchange.

function openLink(url) {
if (url != "") {
location.href = url;
}
else {
alert("Please make a selection.");
}
}

The new page also contains the menu, but sometimes the last menu is not updated properly on the new page. It seems like the cookie is read by the new page before being written by the old page.

I suspect adding a small delay could help, but when I try, the new page doesn't open anymore. Probably a scripting error on my part. This is what I tried:

function openLink(url) {
if (url != "") {
setTimeout('location.href = url', 250);
}
else {
alert("Please make a selection.");
}
}