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.

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() {
document.forms["smth"].submit();
}
</script>
<form name="smth" action="...." method="post">
<select name="numberOne" onchange="postForm();">
option. value 1
option, value 2
etc
</select>

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 
blahblahb
RS.MoveNext
Wend
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.