If a user enters a gene and doesn't select any of the dropdown options, server-side search for exact matches.
If one match is found, store the ensembl ID as the underlying ID.
If no matches are found, store the user-entered text as the underlying ID.
You can also look if there's that exact thing suggested in the dropdown list when focusing out, and if it is, act like it was clicked.
Good point. That would probably be the most common case too.