469,890 Members | 1,579 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

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.

Jul 23 '05 #1
2 3046
On Thu, 22 Apr 2004 10:10:35 +0800, Jorntk <jo****@yahoo.com> wrote:
How can I make a drop down menu that are dynamically generated base on
the value selected in another drop down menu?
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.com/groups?num=50&hl=en&lr=&ie=UTF-8&oe=UTF-8&q=group%3Acomp.lang.javascript+populate+second+% 7C+other+select+%7C+drop+menu+%7C+element&btnG=Sea rch>
values in both menu will need to be from mysql query.


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.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #2
"Jorntk" <jo****@yahoo.com> wrote:
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.


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:
http://www.mattkruse.com/javascript/dynamicoptionlist/

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/
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Greg Scharlemann | last post: by
2 posts views Thread by LRW | last post: by
9 posts views Thread by Gianni | last post: by
1 post views Thread by Nathan Bloomfield | last post: by
19 posts views Thread by mart2006 | last post: by
6 posts views Thread by mcgrew.michael | last post: by
10 posts views Thread by mart2006 | last post: by
reply views Thread by Slickuser | last post: by
reply views Thread by Slickuser | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.