473,320 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to make list menu dependent

25
hello everybody,

i have a problem in my system related to list menu dependent.
i want a simple list menu dependent that when we select A, it show B, when select B it show C and so on.

If possible, i want write down all data in option list menu like below:

<option value="test"/>Test</option>

I mean i dont want the value store at javascript section like:

region["test"] = [{value:"test2", text:"test2"},

please somebody help me.
thank you
Apr 20 '10 #1
1 2566
dlite922
1,584 Expert 1GB
Hierarchical menus?

i.e. You select a state, then a county in that state, then a city in that county?

There's two ways to do it. As you may already know (if not burn it in your memory) PHP is server side. All PHP code never gets processed by the browser and hence the user.

So you must communicate back with the server which option was selected in Menu or List A to give you the list that should appear in B.

There's two methods of doing this.

1. Forms. Submit the form and the value of option A to the server and produce a list for option B (the onChange() attribution of the <select> tag comes in handy for this.

2. AJAX. You submit a variable to a php page and it returns a list that can be ingested by JavaScript and used to populate list B.


Obviously, option 2 is harder but more preferred. The user does not have to wait for the page to reload (which might also reset the scroll position of the page to TOP on some browsers like IE)

Your question, by the way, has been answered before here on bytes:
http://bytes.com/topic/javascript/an...own-list-forms


Good luck,



Dan
Apr 22 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jim Moe | last post by:
Hello, I am (slowly) in the process of changing a table-based layout to CSS/div-based. One area that uses tables a lot is the main nav menu. I have discovered that tables have advantage: all...
2
by: Brian | last post by:
Hello, I want to design some menus for websites with submenus. I'd like to learn the code myself and I was wondering a good place to pick up on some tips on how to design them. Also, is there...
1
by: paakwesi | last post by:
I'm looking to modify the javascript behavior on http://research.yale.edu/%7Ekamusi/exercises/learners/index.php to do two things: Initial State: Both menus are populated with all their entries...
2
by: computer_angel | last post by:
can someone help me pls.... how to get the value from the mysql when using two drop down that is dependent to the first? For example....(online enrolment) department then the other dropdown...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
1
by: mike | last post by:
I have 2 sites in my company. My .NET site uses a master page and a Menu control connected to a sitemap. In my sitemap file I would like to be able to do something like this: <sitemap>...
1
by: Christina | last post by:
Hi, I've been looking at some code for dependent list boxes to adapt to a State and City list. There will only be 2 states for the first list box, and 3 cities in the second list box. When the...
1
by: jmartmem | last post by:
Greetings, I have a nagging problem with client-side dynamic dependent list boxes that perhaps someone can help me troubleshoot. I have a form with a series of dynamic dependent list boxes....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.