Business Requirement:
Form to upload a document and assign attributes to the document that are sourced from an external database. There are 10 form fields and as the user fills in values on the form, the other fields are filtered in real time. I.e. If they select “United States” for country, the state / province field only allows US states.
UX Challenge:
Many of these fields start off with literally millions of possible values so I used jQuery autocomplete for them. As the fields are filtered the number of possible options drop to a number that would be better serviced by a drop-down list.
Question:
Is there a way to dynamically change a jQuery autocomplete field to a dropdown box once the number of options drop below a certain number? I looked at the jQuery autocomplete option but I don’t want to fill a combobox with 1 million+ records even if the user won’t see them all.
I solved the issue for a UI / UX perspective. I have a background function that lets me know the number of options available for each field. With that information I programmatically change the minlength and delay option. I also bind / unbind a function for the focus event and style it (thanks @Interstellar_Coder) appropriately. This gives the user the immediate response associated with a dropdownlist.
Below is simple version of what I’m doing. I’m using button click events to mimic what I’m doing programmatically in my actual application.