SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic linking of menu/lists/radio buttons?

    OK.. so what I'm about to ask may not be ASP-based, but what the hey, here it goes:

    Basically, I have 2 separate drop-down lists, we'll call them List1 and List2.

    Say List1 contains:
    Fruits
    Months
    Sex

    Now, I would like all 2 lists to be on the same page. A user would proceed to select something from List1, say "Fruits". Upon clicking on the drop down list for List2, the list items should automatically be updated to predefined items, say "Apples", "Oranges" and "Pears".

    if the user changes his mind and goes back to select "Months" from List1, List2 should immediately display stuff pertaining to List1 items, say "January", "February", "March" etc etc....

    Any idea how to do this? Seems simple enuff but I have no idea!

  2. #2
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are a couple of ways to do this. I think the simplest way is to use layers and dhtml to show/hide the layers depending on which option you select.

    Here is a thread to something similar (using the layer technique, but with a radio button). You should be able to apply it directly to a select list

    http://www.sitepointforums.com/showt...down+dependent

    You can also use javascript arrays, which I think are a bit more complicated.

    Or you can use the OnSelect method and refresh the page and populate the list using ASP.

  3. #3
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [i]Or you can use the OnSelect method and refresh the page and populate the list using ASP. [/B]
    Hmmm... any links on using this method? This sounds interesting....

  4. #4
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    um...cant find any links? Here is an example of what I mean
    I'm using the onChange and NOT onSelect ..my mistake..

    ...This is just a rough estimation of what you will need to do...
    [vbs]
    <%
    strGetValue = Request.QueryString("value")
    'use this to dynamically populate query
    'do query stuff here

    %>
    <html>
    <head>
    <script language="java script">
    function changeMENU(){
    if (document.main.ssmenu.options[document.main.ssmenu.selectedIndex].value != "none"){
    window.location=document.main.ssmenu.options[document.main.ssmenu.selectedIndex].value
    }
    }
    </script>
    </head>
    <body>
    <form name="main" method="post">
    <select name="ssmenu" onChange="changeMENU()" size="1">
    <option value="none">Select</option>
    <option value="http://www.yourdomain.com/page.asp?value=fruit">Fruit</option>
    <option value="http://www.yourdomain.com/page.asp?value=months">Months</option>
    </select>

    ' Your second drop down
    <select name="ssmenu2">
    <option value="none">Select</option>
    <% do while not rs.eof %>
    <option value="<%= rs("x")%>"><%= rs("x")%></option>
    <% rs.movenext
    loop %>
    </select>
    </form>
    </body>
    </html>
    [/vbs]

  5. #5
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    awrite... will give it a shot... TQ!

  6. #6
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


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
  •