Disabling the automatic submission of forms with Enter or Return button

The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

If you disable the enter key then no one will be able to submit the form who doesn't have a mouse. You will do much better to get rid of the scripts that are automatically submitting the form prematurely and code it correctly so that all the validation is done from the form onsubmit where it will be run at the correct time.

Browser owners have control over that functionality in decent web browsers and so the ability of web pages to block people from using the functionality that they want is limited. When you attach the validation to the form onsubmit then it doesn't matter how they submit the form it still performs the validation and blocks the submit if the form isn't filled out correctly. Validating there will make it unnecessary to try to block the enter key which you can't do unless your visitors allow it anyway.

Part of what I was struggling with is that the form has dynamically generated javascript components that the user creates as it goes along. For each phase of the process, the user determines how many questions they want to create for a test for the children.

So I balked at the idea of validation at the beginning, because the number of user generated form elements is actually totally determined by the teacher filling out the form. Some forms will be five pages long. Some other forms will be very very short.

But I can still use validation. I can simply put a checkbox at the end that says "I'm done building this form" and have that validated.

So..............validation it is. Thank you so much for helping me to think through this.