#Is there a way to make autocomplete options only accept a listed option - not "custom" inputs?
1 messages · Page 1 of 1 (latest)
that is unfortunately not how autocomplete works because they only serve as suggestions. to do that, you would need to compare the inputted value on your end.
you will need to do input validation yourself. For example for @limpid viper I first try to use the user input exactly, and if it yields no results I do a fuzzy search with that input, grab the first 20 results, and show a string select menu to the user. You can test this by using /pokemon and typing something then hitting enter before the autocomplete populates entries
I see, I was hoping there was an alternative to validating the input (which is what I've been doing - in my case each option's value is an object id related to a mongoDB document, so now I just make it check if the value is a valid ObjectId string)
Thank you both