Autocomplete Validation on Large Set of Data
We have a requirement to validate for all of our autocomplete fields that the text a user enters matches with some value that exists as the ID of our source data. For example, if the source data contains a list of countries and cities like (France - Paris, United States - Chicago, Brazil - Rio de Janeiro), then if the user types in France and it matches one of the countries, the validation will return successfully. Otherwise if the user enters text that does not match with any country, then it will return an error and not proceed in the flow. I was thinking about trying to run a validation that will check every entry in the source data, but I was told that this would take far too long as some of the autocomplete fields have source data that is extremely large. What suggestions would you have to approach this issue? Without looping over every instance of the source data, I don't see how we can verify that the user's input matches something from a list if we're not checking everything from the source list.
Matt