Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable selection list if no results found #41

Closed
marco-s opened this issue Feb 8, 2013 · 1 comment
Closed

Disable selection list if no results found #41

marco-s opened this issue Feb 8, 2013 · 1 comment

Comments

@marco-s
Copy link

marco-s commented Feb 8, 2013

Hi!

Is there a way to disable the selection list if the search query did not return any values? Or, if we get the string "No matches" back to make that element not "selectable"?

What I want to do is that if a search does not find any matches then I'd like to keep whatever is already entered in in the input field. Is that possible?

Thanks!!

@tkirda
Copy link
Member

tkirda commented Feb 8, 2013

In the onSearchComplete callback you can check if there are any suggestions found and do anything you want:

onSearchComplete: function () {
    var instance = $(this).data('autocomplete');
    if (instance.suggestions.length === 0){
        // Do something...
    }
}

@tkirda tkirda closed this as completed Feb 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants