Discussion Locked

Making a Searchable Dropdown box

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a dropdown box on a web form that lists all of the clients for my form to help create routing forms. The code is:

<%
RsList.Source = "select * from tblClients;"
RSList.Open
If Not RSList.EOF Then
RSList.MoveFirst
%>
Select the Client:

<%
Do While Not rslist.EOF
%>
"><%= rslist.Fields("clientnumber") & " " & rslist.fields("name")%>
<%
rslist.MoveNext
Loop
End If
rslist.close
%>

Since we have 2500 clients, this creates a rather long list. What I would like to do is make this list searchable, by allowing users to start typing in the client name and having the list jump to that client. Is there a way to do this in VBscript and ASP?

3 replies

by tony hopkinson

You've two options, get the full list of the clients downloaded onto the client and the search them from there. Or do it serverside by re-querying the data and updating the page based on user input.
e.g. Select * from tbl_clients where "name" like "A%" etc.
Neither is ideal though, and will get less so the more clients you get. You'd be better off adding some grouping fields to the client data and doing several selections, i.e by country/state and client etc. So two drop downs. PIA I know but I'd do this for a client side GUI app, never mind a web based one.
The other option is for them to type in the client's name and then you fill a drop down with your best guesses as to which one they meant.

by atxstranger

I was afraid that was going to be the answer when my searches turned up blank. Thanks for the answer.

This discussion is closed to new replies.