![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
10/11/2008, 18:17
|
![Avatar de hoberwilly](http://static.forosdelweb.com/customavatars/avatar246730_1.gif) | | | Fecha de Ingreso: julio-2008 Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 16 años, 7 meses Puntos: 2 | |
Respuesta: Envio de mensaje js al no haber stock disponible Segun lo ultimo sugerido, entonces quedaria asi:
function checked(valor) {
var cantidad = document.formulario.cantidad_autorizada;
var stock = document.formulario.stock_disponible;
for(i=0;i<cantidad.length;i++){
if(cantidad[i].value>stock[i].value){
alert("stock insuficiente");
return false;
}
}
return true;
}
<form onsubmit="return checked(this.cantidad_autorizada)";
<input type="text" name="stock_disponible" value=<?php echo $row2['stock']; ?>>
<input type="text" name="cantidad_autorizada" id="cantidad" value=" " size="4" maxlength='6'>
...pero no me valida????? o en que estoy errado |