473,385 Members | 2,004 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,385 software developers and data experts.

Dynamic drop down menu?

Haitashi
I want to create a list like Nvidia's menu for selecting drivers.

The user will select from a list the state and he will get the counties for that state.

How do I code the states? I believe the best way is to make an array. How do i do that?

The second menu, the one with the counties should come from a MySQL database table.

So, if a user selects FLORIDA from the menu that feeds off the array list he will get a second list (or dropdown menu) with ORANGE, SEMINOLE, ...

The list for those counties are inside a table called COUNTIES in a database called REGISTRATION.

How can I do this? I've been looking for a comprehensive tutorial and found none :(
Jun 15 '07 #1
5 4296
Wow,

this is quite a task for a newbie ;)

Are you using some JavaScript library? You see it is possible to code all Ajax requests and responses handling yoursel but a good Ajax framework (library) makes it much easier.
Jun 15 '07 #2
I know! I bit of way more than I can handle :P

I've seen libraries out there like but I wouldn't know how to use them once I download them.

I don't mind reading, I just can't find info that explains things in simple terms.

Any library recommendations?
Jun 15 '07 #3
I know only one that I use and it is Ext JS library. The community on the forum there is very helpful - helped me a lot when I was starting.
Jun 16 '07 #4
gits
5,390 Expert Mod 4TB
hi ...

yep ... not a bad task for a newbie ;) ... first let me try to explain how the things would work with ajax (in simple words ;) ) ... and i think ajax is the best way to do that.

Probably your first menulist should come from a database too ... and so we would create a page that displays the menulist with the states you mentioned. With ajax you would only create a page that has an outline, some divs or other document-nodes, that are used as a container for the data that should be displayed when the user performs any action on the page. so you would call a javascript-function 'onload' of your page, that performs an ajax-request and 'onfinalize' it fills your first menulist with the states. For that purpose you basically need 3 things ... the mentioned function that accepts parameters (servicename, language, whatever you want to pass to the server) and sends the XMLHttpRequest (Post/Get) to the server ... the second: a serverside script (php, asp, whatever) that may be invoked by your request (in our case one or more that performs our SQL-queries that gives us the states, counties, etc.) ... and the third: a callback-function that computes the response from your serverside script. in our case that would be a function that may construct the option-nodes for your menulist, probably you use dom-scripting-methods (createElement, appendChild, ...) for that purpose. so whenever an event occurs in your page you would follow this pattern ... assuming you want to create a good page with the 'ajax-technique' ...

it is very difficult to show it here with snippets or to show what you have to code ... and there are a lot of tutorials out there, for example:

AJAX-Tutorial - http://www.w3schools.com/ajax/ajax_intro.asp

if you have some things done ... then ask more specific questions here, and we may help you much better ;) ... than with such common hints. But: try an ajax-tutorial before using a framework ... it will greatly help you to understand what happens in the background and it will give you an idea how such frameworks work! ... with that knowledge you will be able to build slick code and applications ... the frameworks out there handle the ajax-requests for you ... of course ... but they give you a bunch of other things too ... mostly a lot of good ui-widgets that you may use for your application ... but for the purpose you have at the moment ... you only need a request, knowledge in dom-scripting, and may be ... if you have to code your serverside for yourself ... knowledge in any serverside-language to create your services there ...

hope this helps to get you on track to solve your problem ...

kind regards ...

ps: don't hesitate to try to handle the XMLHttpRequest with your own code ... ;) i promise ... there is nothing magic or very difficult with that ... but you have to try it for yourself ... you will see ... it is not much to code for this purpose ...
Jun 17 '07 #5
Thanks for the help guys. My problem is that I'm all theory, no practice. I've read the tutorial.

I found this tutorial that is exactly what I want except for one thing. The cities drop drown menu is static. I want to call it from a database.

Chained select boxes

As I understand it, all I have to do is edit the getCities.php file do that instead of static content, it calls a database.

I know the theory, I need the specific code that I need to place there. For instance, if the user selects the Florida state, then it should look in the database where state = FL and publish those counties.

I have a table called cities_counties and the structure is:
ID
county
countyID
statename
stateabbreviation
Jun 18 '07 #6

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

Similar topics

7
by: jorntk | last post by:
How can i make a drop down menu that are dynamiclly generated base on the value selected in another drop down menu? thanks nad regards Jorn
6
by: Greg Scharlemann | last post by:
I am attempting to populate a drop down menu based on the selection of a different drop down menu. However, it is not working correctly, I cannot figure out for the life of me what exactly happens...
1
by: tribal boy | last post by:
Guys, I am using a dynamic menu which uses xml,xsl a css file and javascript. This works fine when there are no server controls around or underneath it. The problem is whenever the menu...
3
by: scaredemz | last post by:
hi, so i'm creating a dynamic drop-down menu. the menu and the text show up fine in IE but only the drop-down shows in Firefox without the menu text. Below is the fxn code. help pls. function...
19
by: mart2006 | last post by:
I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters what is shown in the dynamic menu....
6
by: mcgrew.michael | last post by:
I hope this is the right group. I am very new to ASP so this is probably a stupid question. I have some vbscript that query's AD and populates a recordset. I know the recorset contains the...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
1
by: azeemqaiser | last post by:
Hi All, I have a form with two drop down controls. I want to change the values of Drop Down Menu 2 if i select some value in Drop Down Menu 1. Like If i select country then all the states of...
2
by: vinceboy | last post by:
Hi anybody. I am newbie here and would like to know that how can I validate both drop down menu and radio button from a dynamic display form.Something went wrong with my script.The radio button is...
10
by: mart2006 | last post by:
Hi, I'm fairly new to PHP and I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.