un modo potrebbe essere
<form onsubmit="return check(this)">
la funzione check prende il parametro form e lo controlla