I have written the following code and I want that when a user doesn't fill his first name and mothertongue then it'll show the error message. But whats happening is that after showing the alert for the FirstName alert its directly going to the MotherTongue box. Its not even allowing to fill the LastName before MotherTongue is filled. Why is this happening? Please help me to overcome the problem.
details.html
<html>
<head>
<script>
function ff1()
{
if(document.f1.FirstName.value=='' || document.f1.MotherTongue.value=='Mother Tongue'){
alert("Please enter your First Name");
document.f1.FirstName.focus();
return false;}
if(document.f1.MotherTongue.value=='' || document.f1.MotherTongue.value=='Mother Tongue'){
alert("Please enter your Mother Tongue");
document.f1.MotherTongue.focus()
return false;}
return true;
}
</script>
</head>
<form method="post" action="filenext.php" name="f1" onBlur="ff1()>
Name :
<input name="FirstName" type="text" class="dropmenu" id="FirstName" value="First Name" size="15" maxlength="30" onBlur="ff1()"/>
<input name="LastName" type="text" class="dropmenu" id="LastName" value="Last Name" size="20" maxlength="30"/><br />
Mother Tongue :
<input name="MotherTongue" type="text" class="dropmenu" id="MotherTongue" value="Mother Tongue" size="20" maxlength="30" />
<input name="submit" type=submit class="button" value="submit" />
</form>
</html>