[thelist] IE autocomplete and onblur

Peter-Paul Koch pp.koch at gmail.com
Fri Nov 5 05:35:00 CST 2004

> MSDN's page:
> http://msdn.microsoft.com/library/default.asp?url=/workshop/author/forms/aut
> ocomplete_ovr.asp
> says:
> <quote>
> 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.
> </quote>
> I have a page that performs mathematical calculations based on several
> inputs. These calculations are performed when the values change. If a user
> uses the autocomplete feature of IE, then the calculations need to be
> performed as well.
> The solution we are presently testing instead is to use the onblur event.
> This event fires when the user leaves the input, including if he leaves it
> by pressing the Tab key to select a choice in his autocomplete dropdown.
> Can anyone suggest any other issues I should examine before we release this
> code? This is the site I mentioned before which requires MSIE 6 with JS
> enabled.

You might try the change event, I've often used it in such contexts.
It's more useful than blur, because it fires at the same moment but
*only* when the value of the input has actually been changed.

You might create a large "Calculate" button. Either it gets a click
event of its own, or it only serves to secretly activate the
blur/change event on other form fields when the user clicks on it.

Test what happens when the user hits Return or Tab. Sometimes scripts
fire at an awkward moment in such situations.

ppk, freelance web developer
Interactie, copywriting, JavaScript, integratie

More information about the thelist mailing list