How to "force selection" with YUI 3 Autocomplete?
I am using YUI 3 to create an autocomplete box in which I would like to force the selection and require the user to select a result from the container, or else the input field is cleared of whatever value they have typed in manually.
forceSelection
was a feature in t开发者_高级运维he YUI 2 Autocomplete widget
and info here.
But... it does not look like it has been added to the new YUI
3 version yet.here's the open ticket.
I would just use YUI 2 Autocomplete, however I am already using other improved features that came with YUI 3.
Is there an easy way to implement this manually for YUI 3?
Ryan Grove from the YUI team recently posted this:
This feature is currently targeted for 3.5.0. In the meantime, it's not too hard to implement forced selection by hooking into AutoComplete events. Here's a very basic example that you could build on: http://jsfiddle.net/rgrove/aJcqt/
精彩评论