Everything works great, but how do I prevent ENTER from submitting the
form. When people use this, they usually start typing, see the tag
they want, use the arrow keys to select the tag, then hit enter to
select it. However, rather than do what is expected, the form gets
submitted. It drives the user nuts.
I want enter to submit the form only when not selecting a tag from the
auto-complete list. Is this possible?
The option goes in the hash that is the 3rd argument of text_field_with_auto_complete.
Also, this problem looks to be limited to FF 2 on OSX. Enter does not
submit the form on Safari 3, WinFF2, or IE7.
Yes, I am no JavaScript expert but experience says that particular issue is a bit brittle.
I don't like disabling the return key that way indeed. I'd prefer to let the user select with the keyboard using the return key in the completion list, and still be able to send the form if he's in the very text field. I have not found a way to accomplish that in a robust and portable way.