text_field_with_auto_complete - Trigger on NonSelecting

model_auto_completer (http://agilewebdevelopment.com/plugins/model_auto_completer) needed something similar. In this case the feature is to rollback to the last valid completion if the user enters free text.

To accomplish this the textfield has a custom cache attribute. When the user selects some completion the cache is reset in :after_update_element. There's an onblur handler that compares the cache to the current value, and rollbacks if they are different. In your case you'd show the warning.

That's the basic idea, have a look at its implementation for further details.

It is an onchange handler currently.