The form has an event "onsubmit" (like the input that have onclick), the idea would be that event calls your validation function.
Check this, I think that it is the solution
<script language="Javascript" type="text/javascript">
function validateForm(){
...
}
</script>
<form method="post" name="createform" onsubmit="validateForm()">
...
</form>
Daniel