rniemeyer / knockout-jqAutocomplete

knockout-jqAutocomplete is a Knockout.js plugin designed to work with jQuery UI's autocomplete widget.
MIT License
49 stars 20 forks source link

cleaning selection #4

Open gaydenko opened 10 years ago

gaydenko commented 10 years ago

Ryan, thanks for the plugin.

Have not found a way how to deal with a situation when client has selected an item from the list, but then cleaned input field. At this point submitting a form results in as the object was selected before field cleaning is still selected.

How to deal with such use case?

gaydenko commented 10 years ago

At the moment I have appended init() with

            if (typeof options.elementHook === "function") 
                options.elementHook.call(context.$data, element);

It permits to add listeners to element in needed way, keeping all code in one place. I'm not sure context is really needed, probably null would be sufficient.

What do you think?