Hi Guys, hope you can help.

I have a web base application written with HTML and ASP. However I want to have a combo box function and I really need your help.

I have 2 combo boxes. The first combo box is populated from a MSAccess database. What I want is that on choosing an option from combo box 1, Combo box 2 will be populated from shortlisted items in the database. I already know how to get combo box 1 populated; my problem is how to get combo box 2 automatically populated.

eg. Combo box 1 options : dog, car, house

If a person choose CAR, combo box 2 should automatically populated with items relating to car.

Another note: Combo box 1 will consist of perhaps 8 options. The database has a table of about 70 items, but I just want the ones that pertain to the option choosen in combo box 1 to be displayed as options for combo box 2.

Any assistance will be hugely appreciated.

8 Years
Discussion Span
Last Post by madmital

You can put an "onchange" javascript event on combobox 1 that submits the form.
Then serverside you can read the value of the chosen combobox 1 value, read out values from the database, and create new markup for combobox 2.

<script type="text/javascript">
function postForm() {
<form name="smth" action="...." method="post">
<select name="numberOne" onchange="postForm();">
option. value 1
option, value 2

Serverside on form submit:

'read out values for combobox 1

Set rs = dbConn.Execute "SELECT * FROM tableName WHERE relationField = " & request.form("numberOne")

While Not Rs.EOF 
This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.