jquery - Can I force a user to choose the auto complete in a Rails form? -


right in rails app user can type in in form or choose auto complete list comes up. there way force user choose list e.g. validation?

this not same dropdown list. imagine pick tag in stackoverflow, should similar, though doesn't prevent picking weired tag nobody has seen.

and it's possible javascript validation.

you catch event when text field lost focus. can 2 things:

  1. your app pick first matching value input. example, user input "fac", , there options "facebook", "facetime", "faceblah". if user don't continue input , lost focus, value end "faceblah" first choice.

  2. what if user leave focus invalid value? "fad", matching none result. check if input value within returned json array. if not, warning appear showing input invalid. , add cretieria prevent form submitted.


Comments