Ciao websun![]()
mi spiace ma così non funziona.
qualsiasi radio vado a scegliere mi viene mostrato il messaggio
"immagine_auto: campo non spuntato".
Secondo me dando la classe="si" a tutti i radio, il JS si aspetta che tutti siano checked.
Per tutti gli altri controlli il resto del codice JS funziona regolarmente.
Per comodità posto anche un frammento di codice JS
codice:function check_valid(theForm) { for (i=0; i < theForm.elements.length; i++) { if (theForm.elements[i].value == "" && theForm.elements[i].className == "si") { alert (theForm.elements[i].name + ": campo vuoto non accettabile"); theForm.elements[i].value = ""; theForm.elements[i].focus(); return false; } if (theForm.elements[i].className == "si") { if (theForm.elements[i].name == "immagine_auto") { // radio if (theForm.elements[i].checked == false) { alert(theForm.elements[i].name + ": campo non spuntato"); // theForm.elements[i].value = ""; theForm.elements[i].focus(); return false; } } if (theForm.elements[i].name == "privacy") { // checkbox if (theForm.elements[i].checked == false) { alert(theForm.elements[i].name + ": campo non spuntato"); // theForm.elements[i].value = ""; theForm.elements[i].focus(); return false; } } if (theForm.elements[i].name == "username") { // text var errato=""; errato = verify_username(theForm.elements[i].value); if (errato != "") { alert ("Per " + theForm.elements[i].name + " " + errato); theForm.elements[i].value = ""; theForm.elements[i].focus(); return false; } } // ============== continua elenco dei controlli da controllare ============== } } } function verify_username (strng) { // ========================= }

Rispondi quotando