Ciao ragazzi,
Sto impazzendo da due giorni sul codice javascript che si occupa di validare il form. Il problema sta nei radio button. Vi posto il codice. Potresti aiutarmi a risolvere il problema xke anche provando a estrapolare da altri post non ho risolto.
questo è il formcodice:function ceckval() { if(document.anagrafica.cognome.value == "") { alert("Si prega inserire il cognome !"); document.anagrafica.cognome.focus(); return false; } if(document.anagrafica.nome.value == "") { alert("Si prega inserire il proprio nome !"); document.anagrafica.nome.focus(); return false; } if(document.anagrafica.sesso.options[document.anagrafica.sesso.selectedIndex].value=="") { alert("Segliere il sesso!"); document.anagrafica.sesso.focus(); return false; } if(document.anagrafica.telefono.value == "") { alert("Inserire un recapito telefonico !"); document.anagrafica.telefono.focus(); return false; } if(document.anagrafica.cellulare.value == "") { alert("Inserire un recapito mobile !"); document.anagrafica.cellulare.focus(); return false; } var email = document.anagrafica.email.value var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/; if (!email_reg_exp.test(email) || (email == "")) { alert("Inserire un indirizzo email !"); document.anagrafica.email.focus(); return false; } // for (counter = 0; counter < anagrafica.pagamento.length; counter++){ // if (!anagrafica.pagamento[counter].checked){ { // alert("Deve essere selezionata almeno un pagamento"); // return false; // } if(anagrafica.condgen.checked != true){ alert("Devi accettare le condizioni generali") return false; } if(anagrafica.privacy.checked != true){ alert("Devi accettare l'informativa sulla Privacy") return false; } return true; }
codice:<form action="conferma_ordine.asp" name="anagrafica" method="post" onsubmit="return ceckval();"> </p> <table class="table_iframe" cellSpacing="0" cellPadding="0" border="0" width="750"> <tbody> <tr vAlign="top"> <td rowSpan="4" width="30"></td> </tr> <tr vAlign="top"> <td class="sottotitolo-pren-tab" width="100%">Qui si completa la prenotazione fornendo i nominativi dei passeggeri </td> </tr> <tr vAlign="top"> <td> <table class="nomi" border="0" width="100%"> <tbody> <tr> <td class="line_bottom_sx"></td> <td class="line_bottom_dx"> <table cellSpacing="0" cellPadding="0" border="0" width="722" height="105"> <tbody> <tr> <td width="255" height="21">cognome</td> <td width="263" height="21">nome</td> <td width="63" height="21">tipo</td> <td width="81" height="21">sesso</td> <td width="50" height="21">c.s.*</td> </tr> <tr> <td width="255" height="23"><input size="20" name="cognome"></td> <td width="263" height="23"><input size="20" name="nome"></td> <td width="63" height="23">adulto</td> <td width="81" height="23"><select name="sesso" size="1"> <option value="">-----</option> <option value="M">M</option> <option value="F">F</option> </select></td> <td width="50" height="23"><input id="slsa.cure" type="checkbox" value="Y" name="invalido"></td> </tr> <tr> <td width="255" height="21"></td> <td width="263" height="21"></td> <td width="63" height="21"></td> <td width="81" height="21"></td> <td width="50" height="21"></td> </tr> <tr> <td colSpan="5" width="720" height="40">NB: Il primo nominativo risulterà intestatario del biglietto. *c.s. = cure e/o assistenza</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> <tr vAlign="top"> <td style="text-align: left" > <table class="nomi" border="0" width="100%" height="380"> <tbody> <tr> <td height="21"></td> </tr> <tr> <th height="21"> BIGLIETTO E MODALITÀ DI PAGAMENTO</p> </th> </tr> <tr> <td class="line_bottom_sx_dx" height="119"> <table style="align: center" cellSpacing="0" cellPadding="0" width="100%" border="0"> <tbody> <tr> <td colSpan="4"></td> </tr> <tr> <td width="20%">telefono</td> <td width="30%"><input id="tel" size="20" name="telefono"></td> <td width="20%">Email</td> <td width="30%"><input id="email" size="20" name="email"></td> </tr> <tr> <td>cellulare</td> <td><input id="mobile" size="20" name="cellulare"></td> <td colSpan="2"></td> </tr> <tr> <td></td> <td></td> <td colSpan="2">›REGISTRATI ORA!</td> </tr> <tr> <td colSpan="4"></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="line_bottom_sx_dx" height="127"> <table cellSpacing="0" cellPadding="0" border="0" width ="100%"> <tbody> <tr> <td noWrap colSpan="4"> <table cellSpacing="0" cellPadding="0" border="0" width="100%"> <tbody> <tr> <td><input type="radio" name="pagamento" value="1">Carta di credito</td> <td>[img]images/g_carte.gif[/img]</td> </tr> <tr> <td><input type="radio" name="pagamento" value="2">Pay Pal</td> <td></td> </tr> </tbody> </table> </td> </tr> <tr> <td noWrap colSpan="4"> <table cellSpacing="0" cellPadding="0" border="0" width="100%"> <tbody> <tr> <td><input type="radio" name="pagamento" value="3">Bonifico Bancariointestato a: NDT AGENCY <ul>[*]Coord Iban: IT13 U030 6915 8016 1532 0177 710[/list] </td> <td></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> <tr> <td height="72"> <table cellSpacing="0" cellPadding="0" border="0" width="100%" height="67"> <tbody> <tr> <td noWrap colSpan="4" height="67"> <table cellSpacing="0" cellPadding="0" border="0" width="100%" height="62"> <tbody> <tr> <td height="21"><input type="checkbox" name="mailing_list" value="1"></td> <td height="21">includimi nella mailing list per ricevere offerte, news ed info</td> </tr> <tr> <td height="21"><input type="checkbox" name="condgen" value="1"></td> <td height="21"><span style="FONT-WEIGHT: bold">accetto le condizioni generali</span> condizioni</a></td> </tr> <tr> <td height="20"><input type="checkbox" name="privacy" value="1"></td> <td height="20">accetto il trattamento dei miei dati personali</td> </tr> <tr> <td height="20"></td> <td height="20"></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <table cellSpacing="0" cellPadding="0" border="0" width="100%"> <tbody> <tr> <td align="center"><input type="reset" value="Torna Indietro" name="B2"> <input type="submit" value="Conferma Ordine" name="B1"></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <input type="hidden" name="Costo_Adulti" value="3025"> <input type="hidden" name="IDperiodo" value="11"> <input type="hidden" name="Quota_Ass" value="0"> <input type="hidden" name="Croc_sist" value="1"> <input type="hidden" name="N_Adulti" value="1"> <input type="hidden" name="Costo_Croc" value="3025"> </form>

Rispondi quotando