Hi guys!
It's my first time on this forum and new to javascript too.
i've trying to do just a simple validation on a form but, i get cought up in a kind of endless loop that can't finish.
here is my code:
HTML Code:
<script language="javascript1.2" type="text/javascript">
<!--
function validate_firstname(field1){
if(document.frmtest.names.value==""){
   window.alert('please fill in the name');
   document.frmtest.names.focus();
}
}


function validate_surname(field2){
if(document.frmtest.surname.value==""){
   window.alert('please fill in the surname');
   document.frmtest.surname.focus();
}
}

//-->
</script>
 

<form id="form1" name="frmtest" method="post" action="">
  <label>
  <input type="text" name="firstname" onblur="validate_firstname(this)"/>
  </label>
  <p>
    <label>
    <input type="text" name="surname" onblur="validate_surname(this)" />
    </label>
  </p>
</form>
As u can see guys, all i want to do is, when some one press tab and didn't fill in a field, then a warning message must show up and, when u click ok it must take u back to the same textfield until u type something.
It's somehow working but, i get both functions being called in some king of an endless loop!

Please help out!
Carlos.