473,466 Members | 1,360 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to make list menu dependent

25 New Member
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 2571
dlite922
1,584 Recognized Expert Top Contributor
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.