Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hold characters when doing lookup in database list 2

Status
Not open for further replies.

MCSGraham

Programmer
May 28, 2002
52
US
I have a page linked to a database query where users lookup the group number they want. Most of the group numbers begin with "00". When a user types in "00" it's fine but when they type in a "7" as the next number in the group number, like "00779", it takes them to the first number beginning with "7", like "7000", instead of the "007" numbers.

Given this, to choose a group number from the database dropdown list the user has to scroll down till they find the exact group number instead of being able to enter the first few numbers for it and be taken close if not to it.

How can I modify my code so when a user enters something like "007" it takes them to that beginning number in the list?

Here's my group number code:

Code:
<td align=center><font face="Bookman Old Style" color="#FFFFFF"><strong>GROUP NO:</strong></font></a></td>
<td><P align=center><SELECT NAME="GROUP" SIZE="1">
<Option selected value="none">CHOOSE A GROUP...</option>
<%
Set rs = connection.Execute("SELECT * From [GROUP_LOOKUP]")
rs.MoveFirst
Do While NOT rs.EOF
  Response.Write "<OPTION VALUE='" & rs("GROUP") & "'>"
  Response.Write rs("GROUP") & "</OPTION>"
rs.MoveNext
Loop

rs.close
Set rs=nothing
%>

Any help would be greatly appreciated
 
If I understand you correctly, you are trying to emulate the type-ahead functionality of applications like MS Access. (the behaviour you are experiencing is the default behaviour for the select element in a web browser)

Here are some examples of doing this:

Simply, you need javascript/dhtml and optionally Client side XMLHTTP or XML Data Island - but you should be able to achieve what you're asking for with JS and DHTML.

Hope that helps


A smile is worth a thousand kind words. So smile, it's easy! :)
 
Yes, just looking for the type-ahead functionality.

thanks a lot for the help!

This will get me where I need to go...just thought it might be simpler to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top