View Full Version : combo box problems
paul s
08-13-2002, 01:49 PM
How can I make it so that when more than one key is pressed in a combo box it goes to the next letter instead of the first letter? For example if I press 9 then 0 I want it to go to 90-0001.
beetle
08-13-2002, 04:15 PM
You are using an ActiveX combo box?
paul s
08-13-2002, 04:31 PM
I created it with <select> in HTML and populate it with values from a database table using ASP. I included the code incase it helps.
<select name="cboStudies" id="cboStudies">
<option value="empty"></option>
<%
set rsSearchStudyNum = Server.CreateObject("adodb.recordset")
rsSearchStudyNum.Open "SELECT StudyNum FROM tblStudies ORDER BY StudyNum",conSearchStudyNum
do while not rsSearchStudyNum.EOF
%>
<option value="<%=rsSearchStudyNum("StudyNum")%>"><%=rsSearchStudyNum("StudyNum")%></option>;
<%
rsSearchStudyNum.MoveNext
Loop
rsSearchStudyNum.Close
set rsSearchStudyNum = Nothing
%>
</select>
beetle
08-13-2002, 04:53 PM
Well, as I mentioned in another post, a SELECT object IS NOT a combo box. Now, on to your problem...
If it's going to work at all, this is the process you need
1. Cancel the onChange event
2. Use onKeyDown or onKeyPress to capture the pressed key
3. Store pressed key in a string (appending each keypress)
4. Search the innerText property of all the options using the string mentioned in #3
5. Set the selectedIndex property of the SELECT object to the proper index based on your search.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.