For Fields
Place in the head section of the page
<script>
function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,

=="required"){
if (((tempobj.type=="text"||tempobj.type=="textarea") &&tempobj.value=='')||(tempobj.type.toString().cha rAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("One or more of the required elements are not completed. Please complete them, then submit again!")
return false
}
else
return true
}
</script>
Add this to the "INSIDE TAG" of your form
<form onSubmit="return checkrequired(this)">
then lastly add "required" to each of names you called your boxes i.e. requiredname
Submit Button
Place in the head of the page
<script type="text/javascript">
//Enter error message to display if submit button has been pressed multiple times below.
//Delete below line if you don't want a message displayed:
var formerrormsg="You\'ve attempted to submit the form multiple times.\n Please reload page if you need to resubmit form."
function checksubmit(submitbtn){
submitbtn.form.submit()
checksubmit=blocksubmit
return false
}
function blocksubmit(){
if (typeof formerrormsg!="undefined")
alert(formerrormsg)
return false
}
</script>
then add the red part in after tag of the form
"
<input type="submit" value="Submit" onClick="return checksubmit(this)">
</form>
Thanks to Simon