ho un problema con questo form... il mio obbiettivo è di obbligare l'utente a mettere le qty giuste cioè minore di quelle disponibili...senza la possibilità di andare avanti se le qty non sono corrette...
Codice PHP:
<html>
<
head>
<
title>Vendita al banco</title>
<
script type="text/javascript">
function 
goFocus(x) {
    
document.getElementById(x).focus();
    
document.getElementById(x).select();
}
function 
confronto(x) {
    if(
document.getElementById(x).value>document.getElementById(x+"_disp").value){
        var 
mess="Quantità Disponibile: ";
        var 
alarm=mess document.getElementById(x+"_disp").value;
        
alert(alarm);
        
setTimeout(function(){goFocus(x);},50);
    }
}

function 
confronto1(x) {
    if(
document.getElementById(x).value>document.getElementById(x+"_disp").value){
        var 
mess="QTY Disponibile: ";
        var 
alarm=mess document.getElementById(x+"_disp").value;
        return 
alarm;
    }
    else {var 
alarm="";return alarm;}
}

function 
check(){
for (
i=1i<50i++) {
var 
qty=confronto1(document.getElementById("qty"+i).id);
if (
qty!="")    {
   
alert(alarm);
        
setTimeout(function(){goFocus(document.getElementById("qty"+i).value);},50);
return(
false);
}
}
return(
true);}
</script>
</head>
<body onload="document.pro.prod.focus();">
<form name="pro" onsubmit="return check()" method="post">

 QTY<input type="text" name="qty32" id="qty32" value=1 onBlur="confronto(this.id)">
 <input type="hidden" name="qty32_disp" id="qty32_disp" value=-1 >

 id=32||qty disponibile=-1||modello=mod_prod_1||immagine=prod_1.gif
 

 QTY<input type="text" name="qty35" id="qty35" value=1 onBlur="confronto(this.id)">
 <input type="hidden" name="qty35_disp" id="qty35_disp" value=22 >
 
 id=35||qty disponibile=22||modello=mod_prod_4||immagine=prod_4.gif
 

 QTY<input type="text" name="qty36" id="qty36" value=1 onBlur="confronto(this.id)">
  <input type="hidden" name="qty36_disp" id="qty36_disp" value=4 >
 
 id=36||qty disponibile=4||modello=mod_prod_5||immagine=prod_5.gif


 <input type="hidden" name="prodotto[]" value="32-36-35-">

 barcode:<input type="text" name="prod" id="prod">
 <input type="reset" value="cancella">
 <input type="submit" name="agg" value="aggiungi" >
 <input type="submit" name="fine" value="Finito" >
</form>
</body>
</html>