Disallowing selectbox change
"Gale, David" <[email protected]> Thu, 20 Apr 2006 14:23:29 -0400
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
I'm working on a fairly standard drop-down select navigation widget; now my user wants to add categories to the select, thusly: -- Category1 -- Page1 Page2 Page3 -- Category2 -- Page4 Page5 Page6 When the page is loaded, the appropriate item is selected. If a different "PageN" option is selected, the onchange fires, redirecting appropriately; if one of the Category option is picked, it doesn't submit (easily done). However, if a Category option is selected, it's possible to then select the original page link, causing the page to reload. Is there any way in the onchange handler to disallow the change--so, if the selected option has no value, the select box returns to the previously selected option? Firefox allows me to disable the Category options entirely, which is nice (and avoids the issue), but IE doesn't. I thought returning false might do the trick, as that works for form onsubmits, but no dice. The only other option I can think of is to record where the select ought to be, and, if the user tries to pick something invalid, force the selectedIndex back to the original, but this feels somewhat kludgy. Is there a better option I'm not aware of? Thanks, -David Unsubscribe [email protected] List info http://www.quirksmode.org/dom/list.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/wdf-dom/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/