Ver Mensaje Individual
  #61 (permalink)  
Antiguo 17/11/2008, 12:16
Avatar de hoberwilly
hoberwilly
 
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