[thelist] IE autocomplete and onblur

Hershel Robinson hershelr at netvision.net.il
Thu Nov 4 12:49:21 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 above suggested solution of the onpropertychange event does not fare
well with us because that means that the calculations are performed for each
keystroke the user enters in an input box with such an event handler. This
is not only annoying for some users (to see the results updated so quickly)
but on one page, the calculations are computationally non-trivial and users
with slower CPUs may experience performance degradation.

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.

This solution seems to be working at present with no apparent side effects.
The only code that executes in these onblur event handlers are things like
computing values and displaying them on the page.

I am aware of problems when using onblur and then setting the focus, but on
my pages, no onblur event sets the focus to any control.

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.

Thank you,
Hershel



More information about the thelist mailing list