...

View Full Version : Year Make Model



lansing
01-14-2006, 04:42 AM
I am currently working on a Auto Repair type of site that allows a user to keep track of his vehicle maintenance. I have hand coded the year & make for the drop down menu. I am not working on a page that would allow the user to add a new vehicle to his account. I need to know if there is a site or code that would auto populate the model based on the year & make selected?

I want the user to be able to select the year, then the make, & then the model of their vehicle...

An example is something like this but in the form of a drop down menu:

http://www.partsamerica.com/VehicleSelection.aspx?destinationpage=Default.aspx&year=1995

When you click on the auto maker Dodge...It displays every vehicle made by Dodge in 1995...the link above if for the year 1995. I have the year selection on my site in a drop down menu option. I want all of this to be automatic in populating the models. I don't want to have to type every single model made by every auto make out there for every year. On that same site above it list the vehicles by year also...if you choose a year of 1970 & make as Dodge you wont find Dakota for instance because they didn't make Dakota until 1987.

I have searched google & yahoo & the different web coding forums. Nothing helps...I would think that this is a simple coding since they are sooo many auto parts sites out there....

Thanks!

felgall
01-14-2006, 11:09 PM
Take a look at http://www.felgall.com/jstip22.htm for the Javascript to dynamically populate one dropdown based on the selection in another.

lansing
01-15-2006, 02:05 AM
Take a look at http://www.felgall.com/jstip22.htm for the Javascript to dynamically populate one dropdown based on the selection in another.Thanks!!! I like that even if I have to manually type everything in. I have a couple of questions about that script...

In these lines:
function setOptions(chosen) {
var selbox = document.myform.opttwo;

selbox.options.length = 0;
if (chosen == " ") {
selbox.options[selbox.options.length] = new Option('Please select one of the options above first',' ');

}
if (chosen == "1") {
selbox.options[selbox.options.length] = new Option('first choice - option one','oneone');
selbox.options[selbox.options.length] = new Option('first choice - option two','onetwo');
}
if (chosen == "2") {
selbox.options[selbox.options.length] = new Option('second choice - option one','twoone');
selbox.options[selbox.options.length] = new Option('second choice - option two','twotwo');
}
if (chosen == "3") {
selbox.options[selbox.options.length] = new Option('third choice - option one','threeone');
selbox.options[selbox.options.length] = new Option('third choice - option two','threetwo');
}
}This part in the lines 'oneone' 'onetwo' 'twoone' 'twotwo' 'threeone' & so on & so on...what does that part of the coding do? Is is needed?

felgall
01-15-2006, 10:47 PM
Option('first choice - option one', 'oneone')

translates to

<option value="oneone">first choice - option one</option>

ie. the first parameter is the entry to display and the second parameter is the value that will be passed if it is selected.

The values of chosen will be the values of the option selected from the other dropdown.

lansing
01-16-2006, 11:40 PM
Option('first choice - option one', 'oneone')

translates to

<option value="oneone">first choice - option one</option>

ie. the first parameter is the entry to display and the second parameter is the value that will be passed if it is selected.

The values of chosen will be the values of the option selected from the other dropdown.Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum