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

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 3726
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***********@hotmail.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***********@hotmail.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@databasix 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**********@news6.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**********@news6.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**********@news6.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
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...
1
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...
1
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...
7
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...
0
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...
9
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...
1
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...
1
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...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
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
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,...

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.