Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

using javascript to populate one menu based on the choice in another menu

Community Beginner ,
Jul 08, 2011 Jul 08, 2011

I have several menus which are dynamically populated (with PHP and MYSQL). The information is category based. How do I dynamically populate the second menu based on the choice the user makes in the first menu (without having to submit and refresh the page-- i.e. I need to use javascript instead of the server-side PHP).

Example:

Main Categories: 1) Numbers     2) Letters

Sub Categories:        1                      a

                               2                      b 

                               3                      c

                              etc.                  etc.

the first menu contains the two main categories. I want the second list to be populated with only the sub categories of the main category the user chooses in the first menu (i.e. 1,2,3 etc. if he chose the main category 'Numbers' and a,b,c, etc. if he chose the main category 'Letters')

Is there an easy way to do this in Dreamweaver?

Thanks,

YWSW

TOPICS
Server side applications
636
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 08, 2011 Jul 08, 2011

How many items do you have in each dropdown? If it's a small number, you can download all of the options for the second dropdown and use client side javascript to filter based on the choice of the first dropdown. If the number is large, you'll need to use AJAX to dynamically pull the related items from the database.

Search the web for "dependent dropdown" or "cascading dropdown" for some technical details.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2011 Jul 08, 2011

breqent, thanks for the response.

both the first and second menu are very large. I also have other large sub-category menus as well. I there any simple way to do this in dreamweaver?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 08, 2011 Jul 08, 2011

>I there any simple way to do this in dreamweaver?

I don't know of any DW server behaviors that will do this, if that's what you mean. You're going to need to do some coding here.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2011 Jul 08, 2011
LATEST

okay.

I searched for dependant dropdown as you had suggested and I came across this Adobe article that seems to be reffering to a dreamweaver dependant dropdown wizard, but I cannot find this wizard in my version (cs5). what is wrong?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines