lo metti in una funzione js
function nome(){}
e poi all'onsubmit metterdo
onsubmit="nome(); return false"