Results 1 to 2 of 2

Thread: Chain Select Menu Enhancement

  1. #1
    Join Date
    Nov 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Chain Select Menu Enhancement

    1) Script Title: Chained Select Menu

    2) Script URL (on DD): http://dynamicdrive.com/dynamicindex...menu/index.htm

    3) Describe problem: Is it possible to make the each selection open a predefined URL? I have this so far ...

    Code:
    <form action="detail.php" onchange="loadPage(this.value)">
    <select name="query" style="width:100%;"></select>
    <select name="query2" style="width:100%;" ></select>
    <select name="query3" style="width:100%;" ></select>
    <input type="button" value="Reset" onclick="resetListGroup('vehicles')">
    <input type="submit" value="Search">
    </form>
    
    <script type="text/javascript">
    function loadPage(url)
    {
        location.href = url;
    }
    </script>
    But I have no idea how to go further with it? The kind URL I would like to run each time a user selects would be

    Code:
    detail.php?query= (first menu choice)
    and then

    Code:
    detail.php?query2= (2nd menu choice)
    and so on.

    Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The function that's responsible for taking the final selected OPTION"s value attribute and redirecting the user to that value as a URL is the folliowing inside chanedmenu.js:

    Code:
    function goListGroup(){
    for (i=arguments.length-1;i>=0; i--){
    if (arguments[i].selectedIndex!=-1){
    var selectedOptionvalue=arguments[i].options[arguments[i].selectedIndex].value
    if (selectedOptionvalue!=""){
    if (onclickaction=="alert")
    alert(selectedOptionvalue)
    else if (newwindow==1)
    window.open(selectedOptionvalue)
    else
    window.location=selectedOptionvalue
    break
    }
    }
    }
    }
    This is untested, but try modifying the above to:
    Code:
    function goListGroup(){
    	for (i=arguments.length-1;i>=0; i--){
    		if (arguments[i].selectedIndex!=-1){
    			var selectedOptionvalue=arguments[i].options[arguments[i].selectedIndex].value
    			if (selectedOptionvalue!=""){
    				alert('detail.php?query2=' + selectedOptionvalue) // change alert to location= to redirect
    			}
    		}
    	}
    }
    This should alert the value "detail.php?query2=" PLUS the selected OPTION"s value attribute value. When you want it to redirect instead, just change alert() to location=
    DD Admin

Similar Threads

  1. Xin yang- Chain Select menu
    By weby in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 10-12-2012, 11:25 AM
  2. Topmenu3 and Chain Select Menu
    By Naschina in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 12-03-2009, 07:48 AM
  3. chain select menu help with current page
    By boryyytoe in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 11-06-2007, 02:15 PM
  4. Chain Select menu feature
    By Bornfree in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 06-13-2007, 10:34 PM
  5. Chain Select Menu
    By pepper in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 09-15-2004, 10:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •