Foros del Web » Programando para Internet » Javascript »

ayuda con esta simple validacion

Estas en el tema de ayuda con esta simple validacion en el foro de Javascript en Foros del Web. hola tengo un text y un boton en el text ingreso la cedula osea puros numeros de cuando yo le de al boton me salga ...
  #1 (permalink)  
Antiguo 25/06/2009, 13:15
Avatar de darwin_le  
Fecha de Ingreso: mayo-2009
Mensajes: 63
Antigüedad: 15 años
Puntos: 0
De acuerdo ayuda con esta simple validacion

hola tengo un text y un boton en el text ingreso la cedula osea puros numeros de cuando yo le de al boton me salga un mensaje q me diga ingreso solo numeros y cuando no ingrese nada y le de al boton me diga debes ingresar la cedula

de verdad se lo sabre agradecer
  #2 (permalink)  
Antiguo 25/06/2009, 13:24
 
Fecha de Ingreso: diciembre-2008
Mensajes: 84
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: ayuda con esta simple validacion

A ver si te vale con esta funcion de java

Código:
function enviarFormulario(){
	texto = document.nombreformulario.nombrecampotexto.value;
	if (texto == "")
		alert("Por favor, rellene todos los campos");
	else if (isNaN(texto))
		alert("Solo debe escribir numeros");
	else
		document.nombreformulario.submit();
}
Un saludo
  #3 (permalink)  
Antiguo 25/06/2009, 13:36
Avatar de darwin_le  
Fecha de Ingreso: mayo-2009
Mensajes: 63
Antigüedad: 15 años
Puntos: 0
Respuesta: ayuda con esta simple validacion

hola
no me funciona yo lo coloque asi

Código:
function enviarFormulario(){
	texto = document.form1.cedu.value;
	 if (isNaN(cedu))
		alert("Solo debe escribir numeros");
	else
		document.form1.submit();
}
y nada q puedo hacer
  #4 (permalink)  
Antiguo 25/06/2009, 13:49
Avatar de darwin_le  
Fecha de Ingreso: mayo-2009
Mensajes: 63
Antigüedad: 15 años
Puntos: 0
Respuesta: ayuda con esta simple validacion

este es mi codigo completo el ya me acepta solamente numeros pero lo q pasa es q cuando me sale el mesanje y le doy aceptar me abre la tabla q no deberia mostrarla q solucion me pueden dar

Código HTML:
<head>
<script language="javascript" type="text/javascript">
function enviarFormulario(){
	texto = document.form1.cedu.value;
	 if (isNaN(texto))
		alert("Solo debe escribir numeros");
	//else
		//document.form1.submit();

}
</script> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>

<style type="text/css">
<!--
.Estilo30 {font-size: 12px; color: #185984; font-family: Verdana, Arial, Helvetica, sans-serif;}
-->
</style>
</head>

<body>
<table width="200" border="0" align="right">
          <tr>
            <td><a href="menu_cesta.php"><h4 align="center">Volver</h4></a></td>
          </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table align="center">
  <tr>
    <td ><form name="form1" method="POST" onSubmit="enviarFormulario()">
	<table align="center"  border="0" cellpadding="0" cellspacing="0">
   <!--DWLayoutDefaultTable-->
   <tr>
     <td  class="Estilo30"align="center" ><strong>EXCLUIR</strong> </td>
   </tr>
 </table>
<table align="center">
<p><th span class="Estilo30">Cedula</span>:
  <input name="cedu" type="text" id="cedu" size="15" maxlength="15" />
  <input type="submit" name="Submit" value="Buscar"  />
</p></th>
 <?php 
if ($_POST['cedu']!=""){
?>
</table>
<p>&nbsp;</p>
<table width="321"  border="2" align="center" cellpadding="0" cellspacing="0" bgcolor="#53BBD9">
  <tr>
    <td width="141"  bgcolor="#53BBD9" align="center"><strong>Apellidos y Nombres </strong></td>
	<td width="187"  bgcolor="#EAEAEA" ><?php echo $row_constancia ['primer_nombre']." ".$row_constancia ['segundo_nombre']." ".  $row_constancia ['primer_apellido']." ". $row_constancia ['segundo_apellido']; ?></td>
  </tr>
  <tr>
    <td width="141" bgcolor="#53BBD9"  align="center"><strong>Fecha de Ingreso</strong></td>
	<td bgcolor="#EAEAEA" ><?php echo $row_constancia['fecha_ingreso']; ?></td>
  </tr>
  <tr>
    <td width="141" bgcolor="#53BBD9"  align="center"><strong>Cargo</strong></td>
	<td bgcolor="#EAEAEA" ><?php echo $row_constancia['descripcion_cargo']; ?></td>
  </tr>
  
  <tr>
    <td width="141" bgcolor="#53BBD9" align="center"><strong>Vicepresidencia</strong>
        </div></td>
		 <td bgcolor="#EAEAEA" ><?php echo $row_constancia['nombre']; ?></td>
  </tr>
  <tr>
    <td width="141" bgcolor="#53BBD9" align="center"><strong>Excluir</strong>
        </div></td>
		 <td bgcolor="#EAEAEA" > <input type="checkbox" value="<?php echo $row_constancia['cedula']; ?>" name="cedula" /></td>
  </tr>
</table>
<p>&nbsp;</p>

      <?php
	 }
	  ?>
	  <table align="center">
<th>
<input type="submit" name="Submit1" value="Actualizar"/></th>
</table>
</form>
<p>&nbsp;</p>

</body>
</html> 
  #5 (permalink)  
Antiguo 25/06/2009, 14:34
 
Fecha de Ingreso: junio-2009
Mensajes: 32
Antigüedad: 14 años, 10 meses
Puntos: 2
Respuesta: ayuda con esta simple validacion

intenta cambiar las siguientes lineas :
Cita:
<form name="form1" method="POST" action="">
,
Cita:
<input type="button" name="Submit1" value="Actualizar" onClick="enviarFormulario()"/></th>
</table>
</form>
suerte!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:17.