Ciao ragazzi, avendo il seguente codice, che mi controlla e che non ci siano campi vuoti e per questo non fa inviare il form all'utente finchè non li riempie, come si può aggiungere la funzione che il campo totale (total) in particolare non possa contenere un numero diverso da 10?
grazie....

<script type="text/javascript">

function formCheck(formobj){

var fieldRequired = Array ("a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15", "a16", "a17", "a18", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "b10", "b11", "b12", "b13", "b14", "b15", "b16", "b17", "b18", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10", "c11", "c12", "c13", "c14", "c15", "c16", "c17", "c18", "total1", "total2", "total1", "total2", "total3", "total4", "total5", "total6", "total7", "total8", "total9", "total10", "total11", "total12", "total13", "total14", "total15", "total16", "total17");

var fieldDescription = Array ("a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15", "a16", "a17", "a18", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "b10", "b11", "b12", "b13", "b14", "b15", "b16", "b17", "b18", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10", "c11", "c12", "c13", "c14", "c15", "c16", "c17", "c18", "total1", "total2", "total1", "total2", "total3", "total4", "total5", "total6", "total7", "total8", "total9", "total10", "total11", "total12", "total13", "total14", "total15", "total16", "total17");


var alertMsg = "Per favore completare tutti i campi";

var l_Msg = alertMsg.length;

for (var i = 0; i < fieldRequired.length; i++){
var obj = formobj.elements[fieldRequired[i]];
if (obj){
if (obj.type == null){
var blnchecked = false;
for (var j = 0; j < obj.length; j++){
if (obj[j].checked){
blnchecked = true;
}
}
if (!blnchecked){
alertMsg += " "
}
continue;
}

switch(obj.type){
case "select-one":
if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
alertMsg += " "
}
break;
case "select-multiple":
if (obj.selectedIndex == -1){
alertMsg += " "
}
break;
case "text":
case "textarea":
if (obj.value == "" || obj.value == null){
alertMsg += " "
}
break;
default:
}
}
}

if (alertMsg.length == l_Msg){
return true;
}else{
alert(alertMsg);
return false;
}
}

</script>