dynamic option menu

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jorntk

    dynamic option menu

    How can I make a drop down menu that are dynamically generated base on the
    value selected in another drop down menu? values in both menu will need to
    be from mysql query.



  • Michael Winter

    #2
    Re: dynamic option menu

    On Thu, 22 Apr 2004 10:10:35 +0800, Jorntk <jornrk@yahoo.c om> wrote:
    [color=blue]
    > How can I make a drop down menu that are dynamically generated base on
    > the value selected in another drop down menu?[/color]

    I take it that you haven't bothered to check other posts made this week,
    or posts in the group's archives? A very similar question was asked about
    six hours ago!

    <URL:http://groups.google.c om/groups?num=50&h l=en&lr=&ie=UTF-8&oe=UTF-8&q=group%3Acom p.lang.javascri pt+populate+sec ond+%7C+other+s elect+%7C+drop+ menu+%7C+elemen t&btnG=Search >
    [color=blue]
    > values in both menu will need to be from mysql query.[/color]

    Is the second query dependent on the first selected value? If so, you'll
    have to do it all on the server. If there is a significant number of
    options for the second SELECT element, it's probably better leaving the
    work to the server again, so that you don't burden the user with
    unnecessary data.

    Mike

    --
    Michael Winter
    M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

    Comment

    • Matt Kruse

      #3
      Re: dynamic option menu

      "Jorntk" <jornrk@yahoo.c om> wrote:[color=blue]
      > How can I make a drop down menu that are dynamically generated base on the
      > value selected in another drop down menu? values in both menu will need to
      > be from mysql query.[/color]

      There are a variety of methods and libraries to do this. I have a library
      available here that will do all the work for you:


      The basic idea is that when you change the parent list, you need to clear
      out all the options in the child list, and create new Option() objects to
      put into the child list.

      --
      Matt Kruse
      Javascript Toolbox: http://www.mattkruse.com/javascript/


      Comment

      Working...