Ver Mensaje Individual
  #3 (permalink)  
Antiguo 14/01/2014, 11:12
anju_81
 
Fecha de Ingreso: junio-2008
Mensajes: 25
Antigüedad: 15 años, 11 meses
Puntos: 0
Respuesta: Validar campos en formulario

Cita:
Iniciado por caricatos Ver Mensaje
Hola:

En principio el evento se debe asociar al formulario (tag form), y no al botón...

Saludos :arriba.
Hola,

ya lo he modificado y sigue sin salir ningún mensaje que me indique que debo rellenar esos campos...!

<script>
function revisar() {
if (nombre == "") { alert("Rellene el nombre") ; return false ; }
if (poblacion == "") { alert('Rellene la población') ; return false ; }
if (email == "") { alert('Debes indicar un e-mail') ; return false ; }
if (telefono == "") { alert('Rellene un teléfono de contacto') ; return false ; }
}
</script>


<td width="439" valign="top"><form method="post" onsubmit="revisar()" name="contact" enctype="multipart/form-data" action="mailform.php">
<table width="437" border="0">
<tr>
<td>
<label for="author">Nombre:</label>

</td>
<td colspan="2"><input name="nombre" type="text" id="nombre" value="" size="30" />
*</td>
</tr>
<tr>
<td>
<label for="author">Dirección:</label>
</td>
<td colspan="2"><input name="direccion" type="text" id="direccion" value="" size="40" /></td>
</tr>

a ver si me puede echar una mano...gracias