473,473 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Auto Complete Drop Down Problem

Hi
I have some javascript which allows me to have some sort of
autocomplete functionality for drop downs but I cannot get the
selectedIndex event to fire when the user selects the item from the
drop down. Typically I want the user to be able to select from a drop
down by typing and then autocompleting depending on what he types.
Then I need the selectedIndex changed event to fire so that I can do
some run serverside code.
C# as follows:

myDDL.Attributes.Add("onkeydown", "checkKey(this, event);return
false;");
javascript as follows:

var searchID;
var searchValue;

function checkKey(oList, e) {
// Re-initialize if the
if(oList.id != searchID) {
searchID = oList.id;
searchValue = "";
}

var theKey;
var binIE;
// check for browser event model
if(window.event) { theKey = window.event.keyCode; binIE = true; }
else { theKey = e.which; binIE = false; }
logThis("new keycode = " + theKey);
if(theKey == 8) { // check for backspace
searchValue = ""; // clear the filter
}
// check for alphanumeric keys and append to the search value
else if((theKey >= 48 && theKey <= 57) || (theKey >= 65 && theKey
<= 90) ||
(theKey == 32) || (theKey >= 96 && theKey <= 105)) {
searchValue += String.fromCharCode(theKey).toLowerCase();
}
else { return false; }
// loop through the list to select the proper item
if(searchValue != "") {
for(var iCheck=0;iCheck<oList.options.length;iCheck++) {

if(oList.options[iCheck].text.toLowerCase().indexOf(searchValue) == 0)
{
oList.options[iCheck].selected = true;
return;
}
}
}
}

Dec 18 '07 #1
0 1160

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Smithers | last post by:
I am looking to implement a search feature into a Windows Forms MDI application. Specifically I plan to embed 3 textboxes into a toolbar; one for LastName, another for FirstName, and one for...
3
by: John | last post by:
Does anyone have some sample code for building a combobox that will automatically list the remaining folders while you type? I'm looking for functionality similar to the "Look in:" combobox in the...
1
by: robertrozarioa | last post by:
Hi , I am new to ACCESS.please help me out. I am designing a database.I have 3 tables, and have 3 forms based to collect data. 1. Individual ( fields are Name, Email, Status) Status is a...
5
by: joshua.nicholes | last post by:
I have an access database that consists of two tables.A data collection table and a species list table. The data collection table has about 1500 records in it and the species list has about 600....
4
by: magmike | last post by:
I've got a control on my form that allows the user to select a record based on a form field (in this example, the drop down menu shows the company name, followed by the contact name but uses the...
5
by: totalstranger | last post by:
I'm working on a lightweight, auto width, auto centered, one level drop down menu. It's working in FF, IE7 and Safari (all windows versions on my local system), however it fails in Opera. Can...
1
by: glasssd | last post by:
Hi, I was hoping someone might have some ideas on how I can hack around a problem I'm having with the auto-complete feature of the ComboBox. I have a data entry application that uses a pair of...
106
by: bonneylake | last post by:
Hey Everyone, Well i don't know if my question should be in javascript/ajax or coldfusion, i figure this is more of a coldfusion question. But if this is in the wrong section let me know an all...
3
by: Simon van Beek | last post by:
Dear reader, What can be wrong in my ComboBox, the property "Auto Expand" is set to Yes, but by typing in the ComboBox it doesn't expand. Is this because the source of the ComboBox is a...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.