Ver Mensaje Individual
  #13 (permalink)  
Antiguo 17/07/2010, 20:09
Avatar de maximusc7
maximusc7
 
Fecha de Ingreso: julio-2010
Ubicación: Guatemala
Mensajes: 10
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: Validar un formulario y luego abrir popup

Ya se resolvio, con la ayuda de otro amigo. Mil gracias ciscoh4x0r
No todos le tienen paciencia a los novatos.

Voy a dejar el codigo completo por si a más de alguno le sirve, esta es la funcion que valida los campos.

Código:
<!--Abrir ventana-->
<script language="JavaScript">
 function checkear(){
		    if(document.getElementById('nombre').value==''){
			  return false;
			}
if(document.getElementById('direccion').value==''){
			 
			   return false;
			}	
			if(document.getElementById('email').value==''){
			 
			   return false;
			}	
			if(document.getElementById('empresa').value==''){
			   
			   return false;
			}	
			if(document.getElementById('telefono').value==''){
			 
			   return false;
			}	
			if(document.getElementById('comentarios').value==''){
			  
			   return false;
			}return true;
			}


</script>

Esta es la que habre la ventana o popup.

Código:
<script language="JavaScript">function Abrir_ventana (pagina) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=316,height=234,top=50,left=400";
    window.open(pagina,"",opciones);
}
function enviar(){
document.gerElementById('registro').submit();
}
</script>
Y el formulario:

Código:
<form action="creadorcontacto.php"  method="post" id="registro" name="registro" >
<input type="hidden" value="Del Formulario de contacto de misitio.com" name="subject" />
<input type="hidden" value="contactenos_iframe.html" name="redirect" />
<div style="width:542px; height: 274px;">
<div style="width:275px; height: 274px; float: left; text-align: left;">
<div style="width:auto; height:15px;"></div>
<div class="Estilo_font_01" style="width:250px; height:11px; float: left; text-align: left; margin-bottom: 4px;">Nombre:</div>
<div style="width:250px; height:22px; float: left; text-align: left; margin-bottom: 5px;"><input name="nombre" class="forma01_contacto" size="15" maxlength="256" id="nombre" /></div>

<div class="Estilo_font_01" style="width:250px; height:11px; float: left; text-align: left; margin-bottom: 4px;">Direcci&oacute;n:</div>

<div style="width:250px; height:22px; float: left; text-align: left; margin-bottom: 5px;"><input name="direccion" class="forma01_contacto" size="15" maxlength="256" id="direccion" /></div>

<div class="Estilo_font_01" style="width:250px; height:11px; float: left; text-align: left; margin-bottom: 4px;">Correo Electr&oacute;nico:</div>

<div style="width:250px; height:22px; float: left; text-align: left; margin-bottom: 5px;"><input name="email" class="forma01_contacto" size="15" maxlength="256" id="email" /></div>

<div class="Estilo_font_01" style="width:250px; height:11px; float: left; text-align: left; margin-bottom: 4px;">Empresa:</div>

<div style="width:250px; height:22px; float: left; text-align: left; margin-bottom: 5px;"><input name="empresa" class="forma01_contacto" size="15" maxlength="256" id="empresa" /></div>

<div class="Estilo_font_01" style="width:250px; height:11px; float: left; text-align: left; margin-bottom: 4px;">Teléfono:</div>

<div style="width:250px; height:22px; float: left; text-align: left; margin-bottom: 5px;">
  <input name="telefono" class="forma01_contacto" size="15" maxlength="256" id="telefono" />
</div>

<div class="Estilo_font_01" style="width:250px; height:11px; float: left; text-align: left; margin-bottom: 4px;">Escribir a:</div>

<div style="width:250px; height:22px; float: left; text-align: left; margin-bottom: 5px;"><select name="recipient" class="forma02">
      <option value="[email protected]">Información</option>
      <option value="[email protected]">Compras</option>
      <option value="[email protected]">Ventas</option>
      <option value="[email protected]">Finanzas</option>
    </select></div>

</div>
<div style="width:260px; height: 274px; float: right;"><div style="width:auto; height:15px;"></div>
<div class="Estilo_font_01" style="width:250px; height:11px; float: left; text-align: left; margin-bottom: 4px;">Comentarios:</div><div style="width:250px; height:257px; float: left; text-align: left; margin-bottom: 5px;">
  <textarea name="comentarios" cols="24" rows="4" class="forma02" id="comentarios"></textarea>
  <span class="Estilo_font_01">Todos los campos son obligatorios.</span></div></div>
</div>
<div style="width:286px; height: 50px; margin: auto;">
<input name="reset" type="reset" class="botón" value="Borrar" />
 <input name="submit" type="submit" class="botón" value="Enviar" onclick="if(checkear()){Abrir_ventana('correo_enviado.html');}else{alert('Todos los datos son obligatorios');return false}">
</div>
</form>
Espero qu ea más de alguno le sirva. Salu2.

Última edición por maximusc7; 18/07/2010 a las 12:56 Razón: [resuelto]