Prueba poniendo así:
Código PHP:
function valida(form) {
YY_checkform('form1','textfield ','#textfield2','6','Ha ingresado Mal el Código, Intente Nuevamente!!!');
return (validarDato(form)&&document.MM_returnValue);
}
Código PHP:
<form method="post" name="form1" onSubmit="return valida(this)" action="pass.asp">