How do I ensure the form contents is validated before submitting it?

Nitesh Naveen

Instead of having a submit button, make the button a normal one (give type=button instead of type=submit) and do the validations... and once the validations are complete submit the form explicitly by using document.formName.submit() in the onclick of the button.

<input type=button onclick="if(validateFunc()) 
  { document.formName.submit(); }">