473,547 Members | 2,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic dropdown box

Hi - im looking to have two drop down boxs one with makes of car and
the second drop down box to automatically populate with all the model
of that particular make of car. there are about 50 makes and upto 50
models per make.

I just would like to know the best way to do this - javascript or use
a database? it would be a lot of code todo it in javascript wouldnt
it?? help is very much appreciated thanks guys.
Jul 17 '05 #1
8 3736
The answer depends on a few things:

1) Whether or not you are willing to issue a new page request in order
to populate the second list.

2) How much data do you have.

With JavaScript, you'll basically need to download the whole dataset
to the client - which is probably not fair and may even cause a crash
on less well equipped systems, whereas a quick request back to the
server would be pretty breezy by comparison.

OTOH, if you your data set is fairly small (try exporting everything
to a CSV and see what the KB weight is (<120 is a good target); then
JavaScript probably is worth the effort just to avoid an ugly page
refresh.

It is a myth that JavaScript is significantly more difficult than PHP.
A little obtuse, perhaps, but it would be a short leap. There is an
abundance of script templates that do exactly what you describe. I
particularly like hotscripts.com as a resource for this.

Good Luck

On 30 Nov 2004 14:16:21 -0800, ad***********@h otmail.com (adam) wrote:
Hi - im looking to have two drop down boxs one with makes of car and
the second drop down box to automatically populate with all the model
of that particular make of car. there are about 50 makes and upto 50
models per make.

I just would like to know the best way to do this - javascript or use
a database? it would be a lot of code todo it in javascript wouldnt
it?? help is very much appreciated thanks guys.

Ciao,
Ginzo
---------------------------------
War is god's way of teaching
Americans geography
-- Ambrose Bierce
---------------------------------
Jul 17 '05 #2
adam wrote:
Hi - im looking to have two drop down boxs one with makes of
car and the second drop down box to automatically populate
with all the model of that particular make of car. there are
about 50 makes and upto 50 models per make.

I just would like to know the best way to do this - javascript
or use
a database? it would be a lot of code todo it in javascript
wouldnt it?? help is very much appreciated thanks guys.


Unless you enjoy spending a lot of time modifying programs you
should use a database.

By the way, unless you are only dealing with one model year at a
time the models per make will vary from year-to-year. That
being the case you probably should be considering a three
variable situation (Make, year, model) rather than a two
variable situation.

--
Jerry Gitomer
Jul 17 '05 #3
thanks so far guys. i think i will opt for the database option
although i am not sure how i should set this up ie tables etc.
Jul 17 '05 #4
On 1 Dec 2004 10:49:57 -0800, ad***********@h otmail.com (adam) wrote:
thanks so far guys. i think i will opt for the database option
although i am not sure how i should set this up ie tables etc.


The database option for what? What guys? What tables?

Please don't snip _EVERYTHING_ you're replying to.
--
gburnore@databa six dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
=============== =============== =============== =============== ===============
Want one? GET one! http://signup.databasix.com
=============== =============== =============== =============== ===============
Jul 17 '05 #5
Jerry Gitomer wrote:
Unless you enjoy spending a lot of time modifying programs you
should use a database.

I agree. But that does not say you can not use javascript too. You can
use php to generate a javascript using data from a database. The
javascript puts a javascript-array into a javascript-variable that will
later be used to populate the second dropdown when a selection is made
with the first one. The advantage will be that, once the page is
downloaded, the population of the second dropdown will be very fast. Of
course at the cost of a larger page that will take longer to download.

Greetings,

Henk Verhoeven,
www.phpPeanuts.org.

Jul 17 '05 #6
I noticed that Message-ID: <co**********@n ews6.zwoll1.ov. home.nl> from
Henk Verhoeven contained the following:
The advantage will be that, once the page is
downloaded, the population of the second dropdown will be very fast. Of
course at the cost of a larger page that will take longer to download.


And being not useable to people without JavaScript enabled.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #7
Geoff Berrow wrote:
I noticed that Message-ID: <co**********@n ews6.zwoll1.ov. home.nl> from
Henk Verhoeven contained the following:

The advantage will be that, once the page is
downloaded, the population of the second dropdown will be very fast. Of
course at the cost of a larger page that will take longer to download.

And being not useable to people without JavaScript enabled.


I guess Iframes are out of the question also? Is there not a common
ground for browser UI yet?
Jul 17 '05 #8
On Thu, 09 Dec 2004 08:40:40 -0600, Jamie Isaacs <ja***@shsu.edu >
wrote:
Geoff Berrow wrote:
I noticed that Message-ID: <co**********@n ews6.zwoll1.ov. home.nl> from
Henk Verhoeven contained the following:

The advantage will be that, once the page is
downloaded , the population of the second dropdown will be very fast. Of
course at the cost of a larger page that will take longer to download.

And being not useable to people without JavaScript enabled.


I guess Iframes are out of the question also? Is there not a common
ground for browser UI yet?


Well the iframe is completely proprietary. JavaScript at least is
reasonably well standardized - or at least, it is possible to write
JavaScript that runs across browsers.

As for disabling JavaScript, that is a user choice - and at some
point, you have to ask what is a reasonable expectation of your user.
If you don't set a standard like that, you'll kill yourself tring to
consider all the possibilities. That's no to say your standard can't
be to assume JavScript is not available on your target client and I
know, there are some problematic capabilities in Javascript; but
nothing to the extent that it makes sense to cut off your nose to
spite your face.
Ciao,
Ginzo
---------------------------------
War is god's way of teaching
Americans geography
-- Ambrose Bierce
---------------------------------
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3389
by: Bob Alston | last post by:
In 2002, "GrayJay" posted the following code: I did this in a jazz record catalogue to find composers - On a form "frmComposers" Create a text box - txtFindComposer, and add the following sub Private Sub txtFindComposer_Change() Requery Me!.SetFocus
1
7549
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
1
4821
by: russ | last post by:
Hi all, Here's a problem I'm having with a dynamic table. Following the guidelines here (http://www.codeproject.com/aspnet/dynamiccontrols.asp), which make perfect sense. The problem is that the table contains a SELECT box populated on the initial load. Every time I postback I'm inserting a column into the table, the dropdown always...
7
2353
by: Jeff Uchtman | last post by:
I know I have done this but my mind is fried. I have a dynamic dropdown in a form. I need to pull both the dynamic dropdown's ID and name listed in the dropdown. Need a little help with grey matter tonight. Thank Jeff
0
2899
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string strDataValueField; string strDataTextField; public CreateEditItemTemplateDDL(string DDLName,string DataValueField,string
9
3613
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have to create the dynamic controls in the OnInit stage of the lifecycle. Since data from static controls is not yet available in the OnInit stage I...
1
1894
by: phpnewbie2007 | last post by:
I have 2 dynamic PHP dropdowns: The second dropdown populates from the first, depending on what is selected in the first. The page is showing issues in a department: The first dropdown consists of departments- It has 3 options All issues, dept A, dept B If dept A is chosen in the first dropdown, the second dropdown shows all members in...
1
4645
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button ,another row will be created with the same control (I mean another dropdown and 2 button) and so on. and by pressing Remove button the selecetd row will be...
0
3477
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button ,another row...
2
3985
by: raamay | last post by:
I want to have a dynamic dropdown box whose entries would depend on the selection of an entry in the first dropdown box. BUT the second dropdown box should not reload, only the entries inside should get refreshed or reloaded. i have a piece of code to create a dynamic dropdown box from w3schools.com but it has the problem of reloading the...
0
7437
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7703
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7797
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6032
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5081
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3473
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1050
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.