If you have a form, you need to connect to the form’s submit event. If you’re using jQuery, doing so is really, really easy. The basic process is to check for errors, and if errors are found, to stop the “default” action from occurring.
Form Data Validation. Form data validation comes in a couple different forms. Data can be validated at the field level when it is entered by the user, and it can be validated at the form level (i.e. all fields) when the form is submitted or printed.