Let do it together:
1. in the form tag, modify the onsubmit event, when the return is false, the submit will be cancelled
<form method="post" action="" onsubmit="return check()">
2. add ids to the input texts for myparents and yourparents, so that we can access them in javascript function later on:
<input type="text" id="myparents" class="validate[required]" />
<input type="text" id="yourparents" class="validate[required]" />
3. Now, write the check() function:
<script type="text/javascript">
function check()
{
var myparents = document.getElementById("myparents").value;
var yourparents = document.getElementById("yourparents").value;
var status = true;
if (!myparents.trim()) {
alert("My parents cannot be blank!");
status = false;
}
if (!yourparents.trim()) {
alert("Your parents cannot be blank!");
status = false;
}
return status;
}
</script>
The End.