Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/11/2008, 15:05
Avatar de hoberwilly
hoberwilly
 
Fecha de Ingreso: julio-2008
Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 15 años, 10 meses
Puntos: 2
Pregunta Validacion de caja de texto vacios

Hola amigos, tengo el siguiente codigo js:
function vacio(q) {
for ( i = 0; i < q.length; i++ ) {
if ( q.charAt(i) != " " ) {
return true
}
}
return false
}

function valida(F) {
if( vacio(F.cantidad.value) == false) { //aqui tengo que modificar verdad??????
alert("Tiene que ingresar una cantidad")
return false
} else {
return true
}
}
el cual valida cuando al dar click en submit:
<form action="post" onsubmit="return checked(this['cantidad_autori[]'],this['stock_disponible[]']) && valida(this);"
<input type="text" name="cantidad_autori[]" id="cantidad"> //caja de texto llenado por el usuario
<input type="submit" value="Autorizar"> //boton submit
</form> //fin form

que es lo que puede estar pasando