- Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
If there is only a single suggestion, I would like to fire "onSelect". The reason : beside normal text, I also can receive (long) barcodes on the field. If this is the case, I don't need the extra interaction from the user.
autoSelectFirst : will select the first field but an enter is still required; (which is confusing since it might fire the entire form)
I tried with onSearchComplete, since this is a ajax call. But I can't (or don't know how) to fire onSelect function.
$('#autocomplete').autocomplete({ serviceUrl: 'get_product', onSelect: function (suggestion) { console.log("onselect shot"); var res = suggestion.data; $("#pid").val(res.id); // some more code }, onSearchComplete: function (query, suggestion) { if(suggestion.length == 1 && query.length > 20) { this.OnSelect(0); // this is invalid } }, autoSelectFirst: true, minChars: '2' }); I also tried with onHint, but then I have no idea when there is only 1 result. If I missed the obvious, sorry ! Thanks for this wonderful library !
Metadata
Metadata
Assignees
Labels
No labels