My web form includes a text input field with an autocomplete feature implemented through jquery-ui. The form is actually contained within a jquery-ui dialog as well. I am searching for a solution to automatically accept the auto-complete choice when there is only one option left.
For example, if a user enters 'c', the autocomplete widget suggests 'cat' and 'closet'. If the user then enters 'a', the widget should automatically fill in 'cat' in the input field and close itself.