I've got a tagsinput field with typeahead and everything is working fine. I can type in a value and if any of the typeahead results come up I can select and press enter to have it added to the tag input field.
However, when I enter a tag value that isn't in the typeahead list and press enter, the form is submitted. I want to prevent this behavior and have tried a few methods and just can't seem to get it to work. I've attached a screenshot of the javascript code I have right now. The issue with this code is that, while it does prevent the enter key from submitting the form, it also prevents the enter key from adding the tag.
What I need is to have the enter key work to create the tag but not submit the form. I need this code fix urgently so today if at all possible. Thank you!