views:

675

answers:

2

I have an .ASP page that uses the “onChange” event to trigger a database lookup of information. (After a Code is entered, the system validates the code and places the description next to it. I.E. GP1234 returns GP1234-Rubber Duck or GP1234-Invalid Code). The problem I am having is that my users that have the AutoComplete active get a list of previously used codes presented. If they use one of the codes in the list, the data is enteres, but not event is triggered to direct the page to verify the data. I have tried OnChasnge, OnBlur , and onMouseOut.
Any suggestions ?

+1  A: 

Setting autocomplete="off" on the input will prevent it presenting previously entered values.

If you don't want to do that, the events you're likely looking for are onkeyup (for arrow/enter on the options) and onmouseup (for clicking on the options) events.

wombleton
A: 

From Using AutoComplete in HTML Forms on MSDN:

To determine when a user updates the content of a field from the AutoComplete dialog box, use the onpropertychange event, rather than the onchange event, because the onchange event does not fire.

Note that the onpropertychange event is proprietary to Internet Explorer so you'll still need handling for other browsers, and that it fires after every keystroke so it's not directly compatible with the onchange event.

Simon Lieschke