Este es mi código de un formulario (he quitado cosas de diseño xq no me cabía).
Me inserta correctamente todo pero no me hace las validaciones. ¿Por qué? Gracias
 
[HTML<!-- InstanceBeginEditable name="doctitle" -->
<title>Documento sin título</title>
<!-- InstanceEndEditable -->
<script type="text/JavaScript">
<!--
 
//-->
</script>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
@import url("Gestora2.css");
.Estilo1 {font-size: xx-small}
-->
</style>
<script language="JavaScript" src="Calendario/javascripts.js"></script>
<script language="javascript">
function validar_formulario ()
{
	//Variable que guarda los mensajes de error
	var mensaje_error;
	var mensaje;
	var rol_valido;
	mensaje_error=" ";
	var rol_valido=false;
	if (document.form1.nombre.value == "")
	{
		mensaje_error += "\n\t Nombre - Introduce tu nombre";
	}
	if (document.form1.apellidos.value == "")
	{
		mensaje_error += "\n\t Primer Apellido - Introduce tu primer apellido";
	}
	if (document.form1.Nif.value == "")
	{
		mensaje_error += "\n\t Nif - Introduce tu Nif (numero + letra)";
	}
	if (document.form1.direccion.value == "")
	{
		mensaje_error += "\n\t Direccion - Introduce tu domicilio";
	}
	if (document.form1.poblacion.value == "")
	{
		mensaje_error += "\n\t Poblacion - Introduce tu poblacion";
	}
	if (document.form1.correo.value == "")
	{
		mensaje_error += "\n\t Email - Introduce tu correo electrónico";
	}	
	//Si hay algún campo incorrecto se muestra un mensaje de error
	if (mensaje_error != " "){
		mensaje = "_________________________________________________  _____________\n\n";
		mensaje += "El formulario no fue enviado porque hay campos incorrectos\n";
		mensaje += "Por favor corrige los campos incorrectos y vuelve a enviar el formulario.\n";
		mensaje += "_________________________________________________  _____________\n\n";
		mensaje += "Los siguientes campos necesitan ser corregidos: \n";
 
		alert(mensaje + mensaje_error + "\n\n");
		return false;
	}
 
	return true;
}
</script>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
.Estilo1 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
	font-weight: bold;
}
  <tr>
    <td colspan="14"><!-- InstanceBeginEditable name="Contenido" -->
 
      <table width="100%">
        <!--DWLayoutTable-->
        <tr valign="top">
          <td width="200" height="286" rowspan="5" align="left"><img src="imagenes/menuRegistro2.jpg" width="200" height="286" /></td>
          <td width="1" rowspan="5" align="left" bgcolor="#000166"><img src="imagenes/transparent-wedge.gif" width="1" height="100%" /></td>
          <td height="43" colspan="2" class="tituloRegistro"> <img src="imagenes/IconoPersonal.jpg" width="34" height="43" /> REGISTRO DE USUARIO </td>
        </tr>
        <tr valign="top">
          <td height="2" colspan="2" bgcolor="#FF0000"><img src="transparent-wedge.gif" width="100%" height="2" /></td>
        </tr>
        <tr valign="top">
          <td height="50" colspan="2" valign="middle" class="TextoNormal"><strong><span class="Estilo1">>></span> Para registrarte simplemente tienes que rellenar 5 pasos y empezaras a disfrutar de las ofertas y cursos que te ofrecemos</strong></td>
        </tr>
        <tr valign="top">
          <td height="24" colspan="2" valign="middle" class="TextoNormal">
 
		  <form name="form1" method="post" action="copia_insertar_usuario.php" onSubmit="return validar_formulario();">
            <table width="90%" align="center" bgcolor="#FFFF66">
              <tr>
                <td width="35%" align="right"><span class="FuenteRegistro">Nombre*</span></td>
                <td><input name="nombre" type="text" id="nombre" size="40" maxlength="40" value="<? if (isset ($_POST['nombre'])) { echo $_POST['nombre'];}?>"></td>
              </tr>
              <tr>
                <td align="right"><span class="FuenteRegistro">Apellidos*</span></td>
                <td align="left"><input name="apellidos" type="text" id="apellidos" size="40" maxlength="40" value="<? if (isset ($_POST['apellidos'])) { echo $_POST['apellidos'];}?>"></td>
              </tr>
              <tr>
                <td align="right"><span class="FuenteRegistro">Fecha de Nacimiento* </span></td>
                <td align="left"><? require ("Calendario/Calendario.php");  escribe_formulario_fecha_vacio("FechaNacimiento","  form1");?></td>
				<td align="left"> </td>
                </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Lugar de Nacimiento* </td>
                <td><label for="label13"></label>
                    <input name="lugarNacimiento" type="text" id="lugarNacimiento" size="40" value="<? if (isset ($_POST['lugarNacimiento'])) { echo $_POST['lugarNacimiento'];}?>"></td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">
                  Nif*
                  <label for="radio3"></label>
                  <label for="radio2"></label></td><td class="FuenteRegistro"><label for="label14"></label>
                    <input name="Nif" type="text" id="Nif" size="9" maxlength="9" value="<? if (isset ($_POST['Nif'])) { echo $_POST['Nif'];}?>"></td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Dirección*</td>
                <td class="FuenteRegistro"><label for="label14"></label>
                    <input name="direccion" type="text" id="direccion" size="50" value="<? if (isset ($_POST['direccion'])) { echo $_POST['direccion'];}?>"></td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Población*</td>
                <td class="FuenteRegistro"><label for="label14"></label>
                    <input name="poblacion" type="text" id="poblacion" size="40" value="<? if (isset ($_POST['poblacion'])) { echo $_POST['poblacion'];}?>"></td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Provincia*</td>
                <td class="FuenteRegistro"><label for="label14"></label>
                    <label for="label15"></label>
                    <label for="textfield"></label>
                    <input type="text" name="provincia" id="provincia" value="<? if (isset ($_POST['provincia'])) { echo $_POST['provincia'];}?>"></td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Código Postal* </td>
                <td class="FuenteRegistro"><label for="label14"></label>
                    <input type="text" name="CP" id="CP" value="<? if (isset ($_POST['CP'])) { echo $_POST['CP'];}?>"></td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Teléfono móvil* </td>
                <td class="FuenteRegistro"><label for="label14"></label>
                    <input name="movil" type="text" id="movil" size="9" maxlength="9" value="<? if (isset ($_POST['movil'])) { echo $_POST['movil'];}?>"></td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Teléfono fijo* </td>
                <td class="FuenteRegistro"><label for="label14"></label>
                    <input name="telefonoFijo" type="text" id="telefonoFijo" size="9" maxlength="9" value="<? if (isset ($_POST['telefonoFijo'])) { echo $_POST['telefonoFijo'];}?>"></td>
             </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Estado Civil* </td>
                <td class="FuenteRegistro"><label for="label16"></label>
                    <select name="estadoCivil" id="estadoCivil">
                      <option> </option>
                      <option>soltero/a</option>
                      <option>casado/a</option>
                      <option>divorciado/a</option>
                      <option>viudo/a</option>
                    </select>                </td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Número de Hijos* </td>
                <td class="FuenteRegistro"><label for="label14"></label>
                    <input name="hijos" type="text" id="label14" size="2" maxlength="3" value="<? if (isset ($_POST['hijos'])) { echo $_POST['hijos'];}?>"></td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Email*</td>
                <td><input name="correo" type="text" id="correo" size="50" maxlength="50" value="<? if (isset ($_POST['correo'])) { echo $_POST['correo'];}?>"></td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Permiso de Conducir* </td>
                <td><label for="label17"></label>
                    <select name="tipo" id="tipo">
                      <option> </option>
                      <option>A</option>
                      <option>B</option>
                      <option>C</option>
                    </select>                </td>
              </tr>
              <tr>
                <td align="right" class="FuenteRegistro">Fecha de Expedición* </td>
                <td align="left"><? escribe_formulario_fecha_vacio("FechaExp","form1")  ;?></td>
                </tr>
            </table>
			<table width="100%">
              <tr>
                <td width="80%"><img src="imagenes/guardar.PNG" width="288" height="32" hspace="150" /></td>
                <td width="20%"><input name="image" type="image" src="imagenes/siguiente.PNG" /></td>
              </tr>
            </table>
			</form>		  
        </tr>
      </table>
    <!-- InstanceEndEditable --></td>
  </tr>
  <tr>
      </tr>
</table>
</body>
<!-- InstanceEnd --></html>[/HTML] 
   
 


