![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
17/11/2008, 12:16
|
![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 Por motivos de implementacion, se realizo un cambio en el siguiente codigo (input text)...
<form name="" method="post" action="agregacarrito2.php" id="" onsubmit="return checked(this.cantidad_autori,this.stock_disponible ) && valida(this);">
<input type="text" name="cantidad_autori[]" id="cantidad" value="<?php echo $v['cantidad'] ?>"> //aqui se cambio en array cantidad_autori[]
<input type="text" name="stock_disponible" value=<?php echo $row2['stock']; ?> > //se consulta y visualiza el stock que esta guardado en bd
</form>
codigo js:
function checked(valor1,valor2){
for(i=0;i<valor1.lenght;i++){
if(valor1[i].value>valor2[i].value){
alert("stock insuficiente");
valor1[i].focus();
return false;
}
}
return true;
}
y dejo de funcionar el mensaje de alerta cuando al dar click en submit y la cantidad autorizada sobrepasa del stock(guardado en la bd)
Por favor si me podrian ayudar, gracias |