Code Explanation:

I have one text box for name,and one dropdown when I enter 'bo' then dropdown filled from database.Values in listbox are 1)bob 2)bobby 3)Bony etc exists in db. Now my requirement is given below.

I want the name listbox field expand automatically to show all my matches to what has been entered in the name textbox field. e.g. If I am entering just ‘bo’ in the name field actually 3 names are there but only the first is shown unless the user actually clicks the drop-down, so they sometimes assume that that is the only name that matches and don’t bother clicking to see if there are others.

Hot to make list box expandable in above java script code.?

Pls. advice me asap

Thanks & RegaRDS

Please check this code.

Response.AddHeader "Pragma", "no-cache"
Response.AddHeader "cache-control", "must-revalidate, private, no-cache"
Response.Expires = -1500

Response.Expires = 0
On Error Resume Next
Set DataConnPhoneBk = Server.CreateObject("ADODB.Connection")
DataConnPhoneBk.ConnectionTimeout = Session("DataConnPhoneBk_ConnectionTimeout")
DataConnPhoneBk.CommandTimeout = Session("DataConnPhoneBk_CommandTimeout")

'Next line added as ICL had forgot to setup the connection string to the database.

DataConnPhoneBk.Open ("Driver={SQL Server};Server=localhost;Database=WAR;")

Set cmdTemp = Server.CreateObject("ADODB.Command")
Set MapListResults = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = "SELECT Login_id, User_Name FROM User ORDER BY User_Name"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = DataConnPhoneBk
MapListResults.Open cmdTemp, , 0, 1


If MapListResults.EOF then
itsgonewrong = 0
itsgonewrong = 1
end if

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>United Utilities - Tools - Maps and Addresses</title>
<meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1" />
<link rel="stylesheet" href="/styles/kcmain.css" type="text/css" />

<script type="text/javascript" language="JavaScript">

var sites;
sites = new Array(<%
while Not MapListResults.EOF
Response.Write(Chr(34) & Trim(MapListResults("User_Name")) & "|" & Trim(MapListResults("Login_id")) & Chr(34))
if Not MapListResults.EOF then Response.Write(",") end if


function filterSite(evt)
// empty the ddm
doent.SearchMapForm.mapsmenu.options.length = 0;

// grab the filter text
txtFilter = doent.SearchMapForm.filterTxt.value;

// loop through the array of sites to repopulate
if( sites[i].substring(0,txtFilter.length).toUpperCase() == txtFilter.toUpperCase() )
site_ids = sites[i].split("|");
doent.SearchMapForm.mapsmenu.options.length = doent.SearchMapForm.mapsmenu.options.length + 1;
doent.SearchMapForm.mapsmenu.options[doent.SearchMapForm.mapsmenu.options.length-1].value = site_ids[1];
doent.SearchMapForm.mapsmenu.options[doent.SearchMapForm.mapsmenu.options.length-1].text = site_ids[0];


<body önLoad="filterSite(event)">

<% 'side menu %>
<form name="SearchMapForm" id="form1" method="post" action="vibs.asp">
<input name="filterTxt" type="text" id="filterTxt" önKeyUp="filterSite(event)" size="40">
<select name="mapsmenu" size=5>
while not MapListResults.EOF

<option value="<%=MapListResults("login_id")%>"><%=MapList Results("User_Name")%></option>