By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,676 Members | 1,708 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,676 IT Pros & Developers. It's quick & easy.

dynamic option menu

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
"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.