function checkForm(theForm) { if (theForm.realname.value == "") { alert("Veuillez inscrire votre nom d'entreprise, d'école ou d'institution!"); theForm.realname.focus(); return (false); } if (!theForm.code.value) { alert("Veuillez entrer votre code postal!"); theForm.code.focus(); return (false); } if( theForm.tel_area_code.value.length == 0 ) { alert("Veuillez inscrire le code régional."); theForm.tel_area_code.focus(); return (false); } else { var regex = new RegExp("\\d{3}"); if( !regex.test(theForm.tel_area_code.value) ) { alert("Veuillez inscrire 3 caractères numériques."); theForm.tel_area_code.focus(); return (false); } } if( theForm.tel_number_1.value.length == 0 ) { alert("Veuillez inscrire le numéro de téléphone."); theForm.tel_number_1.focus(); return (false); } else { var regex = new RegExp("\\d{3}"); if( !regex.test(theForm.tel_number_1.value) ) { alert("Veuillez inscrire 3 caractères numériques."); theForm.tel_number_1.focus(); return (false); } } if( theForm.tel_number_2.value.length == 0 ) { alert("Veuillez inscrire le numéro de téléphone."); theForm.tel_number_2.focus(); return (false); } else { var regex = new RegExp("\\d{4}"); if( !regex.test(theForm.tel_number_2.value) ) { alert("Veuillez inscrire 4 caractères numériques."); theForm.tel_number_2.focus(); return (false); } } if( theForm.tel_ext.value.length > 0 ) { var regex = new RegExp("\\D{1,}"); if( regex.test(theForm.tel_ext.value) ) { alert("Veuillez inscrire des caractères numériques seulement."); theForm.tel_ext.focus(); return (false); } } if (theForm.nom.value.length < 1) { alert("Veuillez inscrire votre nom!"); theForm.nom.focus(); return (false); } if (theForm.email.value == "") { alert("Veuillez indiquer votre courriel!"); theForm.email.focus(); return (false); } if (theForm.email.value.length < 5) { alert("Veuillez inscrire un courriel valide!"); theForm.email.focus(); return (false); } if (theForm.email.value.length > 50) { alert("Votre courriel doit contenir un maximum de 50 caractères!"); theForm.email.focus(); return (false); } return (true); }