Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/03/2007, 06:00
cmc
 
Fecha de Ingreso: febrero-2003
Ubicación: Capital
Mensajes: 1.317
Antigüedad: 22 años, 1 mes
Puntos: 1
Problemas para validar

Tengo esta funcion pero no funciona

Código HTML:
function validar(f) { 
	var errorMsg = "";
	if (document.f.nombre.value.length == 0) { 
		errorMsg += "\n\tNombre \t- Debe cargar el Nombre, es un dato obligatorio";
	}	

	if (document.f.apellido.value.length == 0) { 
		errorMsg += "\n\tApellido \t- Debe cargar el Apellido, es un dato obligatorio";
	}	

	if (document.f.email.value.length == 0) { 
		errorMsg += "\n\tE-mail \t- Debe cargar el Email, es un dato obligatorio";
	}	

	if (document.f.email2.value.length == 0) { 
		errorMsg += "\n\tConfirmación de E-mail \t- Debe cargar la confirmación del Email, es un dato obligatorio";
	}
	
	if(f.email.value!='' && f.email2.value!=''){
  		if (f.email.value != f.email2.value) { 
			errorMsg += "\n\tConfirmación de E-mail \t- Los campos de email tienen que ser iguales";
  } 
  }

  if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "ERROR!.\n";
		msg += "Por Favor revise los datos ingresados.\n";
		msg += "______________________________________________________________\n\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
		return true;
}
y este formulario

Código HTML:
<form action="form_contactenos.php" method="post" name="Contacto" id="Contacto" onSubmit="return validar(this)"> 
Donde esta el error?
__________________
Claudio Caldareri
diseñador Multimedial
www.disemedios.com.ar