Ver Mensaje Individual
  #6 (permalink)  
Antiguo 10/01/2013, 13:51
fmiguelcapel
 
Fecha de Ingreso: noviembre-2012
Ubicación: Monzón
Mensajes: 157
Antigüedad: 11 años, 5 meses
Puntos: 0
Respuesta: mensaje de envío formulario

primera funcion:
function validacion(){
valor = document.getElementById("nombre").value;
if(valor==null || valor.length==0 || /^\s+$/.test(valor)){
alert('El campo nombre no se puede dejar vacío');
return false;
}
valor = document.getElementById("apellido1").value;
if(valor==null || valor.length==0 || /^\s+$/.test(valor)){
alert('Introduce tu primer apellido');
return false;
}
valor = document.getElementById("apellido2").value;
if(valor==null || valor.length==0 || /^\s+$/.test(valor)){
alert('Introduce tu segundo apellido');
return false;
}
valor = document.getElementById("telefono").value;
if( isNaN(valor) ) {
alert('Introduce un valor numérico en el campo "teléfono"');
return false;
}
/*valor = document.getElementById("email").value;
if( !(/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)/.test(valor)) ) {
alert('La dirección de email no es válida');
return false;
}*/
valor = document.getElementById("mensaje").value;
if(valor==null || valor.length==0 || /^\s+$/.test(valor)){
alert('Debes de dejar tu mensaje');
return false;
}
elemento = document.getElementById("aceptar_condiciones");
if( !elemento.checked ) {
alert('Debe aceptar las condiciones');
return false;
}
return true;
}