Prevent onKeyUp from triggering onBlur?
Posted on 2013-09-16
I have some rather complicated Zip Code input fields. The user may enter a zip code, a city name or a city/state. onKeyUp is used to do a search by zip (after 5 chrs if numeric) - At 6 or more chars, it checks for Canadian zip or city, or city state. The result may show a single entry on an exact match, or a select list on multiple matches.
This all works fine except that it allows the user to exit the field with a "not found" entry, and I cannot figure out how to do a final check when they have left the field.
My first thought was to use onBlur. I quickly discovered that onBlur (as well as onFocus) is triggered with each onKeyUp. Somehow, I need to be able to do a final check on field exit and produce an error message on no match.
Hoping someone has a bright idea here.