function champ(regex, champ) { if(RegExp(regex, "i").test($(champ).val())) return permute_fond(true, champ); else return permute_fond(false, champ); } function permute_fond(etat, champ) { if(etat) $(champ).removeClass("js_fond_rouge").addClass("js_fond_vert"); else $(champ).removeClass("js_fond_vert").addClass("js_fond_rouge"); return etat; } $(document).ready(function() { // var champ_c_email; // var champ_c_password; // var champ_c_password2; // var check_c_agree; // var champ_domain; // var subdomain_bdd; // var mail_bdd; // $("form").submit(function() // { // champ_c_email = champ("^[a-zA-Z0-9._-]{1,150}@[a-zA-Z0-9._-]{1,50}\.[a-zA-Z0-9._-]{1,50}$", "#c_email"); // champ_c_password = champ("^[a-zA-Z0-9._-]{1,32}$", "#c_password"); // champ_domain = champ("^[a-z0-9]{1,128}$", "#domain"); // if(champ_c_password && $("#c_password").val() == $("#c_password2").val()) // champ_c_password2 = permute_fond(true, "#c_password2"); // else // { // champ_c_password2 = permute_fond(false, "#c_password"); // champ_c_password2 = permute_fond(false, "#c_password2"); // } // var a = ''; // if(!champ_c_email) // a += 'Le champ e-mail est obligatoire et doit comporter un format correct
'; // if(!champ_c_password) // a += 'Le mot de passe doit comporter entre 1 et 32 caractères de type alphabétique ou numérique et/ou _-.
'; // if(!champ_c_password2) // a += 'Les mots de passe ne sont pas identiques
'; // if(!champ_domain) // a += 'Le sous-domaine saisi est incorrect
'; // subdomain_bdd = mboost_function_verif_subdomain($("#domain").val()); // if(subdomain_bdd) // { // permute_fond(false, "#domain"); // a += 'Le sous-domaine choisi existe déjà. Merci d\'en choisir un autre.
'; // } // mail_bdd = mboost_function_verif_mail($("#c_email").val()); // if(mail_bdd) // { // permute_fond(false, "#c_email"); // a += 'L\'email que vous avez saisi existe déjà.
'; // } // check_c_agree = $("#c_agree:checked").length; // if(!check_c_agree) // a += 'Vous n\'avez pas accepté les conditions générales d\'affiliation
'; // if(champ_c_email && champ_c_password && champ_c_password2 && champ_domain && !subdomain_bdd && !mail_bdd && check_c_agree) // return true; // else // { // $("#js_erreur").removeClass().addClass("visible").addClass("js_problem").html(a); // return false; // } // }); });