Let’s see! the part of submitting a form by pressing the enter key is simple.
You simply have to place an action attribute on the
Now, the behavior that you want is not just to send the form anywhere, but to execute a Javascript function that performs a check. Then things change.
To get what you want, you have to call that function when you detect a form submission and you have to do that using Javascript. You detect the form submission, then you stop the default submission behavior and finally you call your function.