$(document).ready(function(){ UtilsForm.initCaptcha(); $("#pageContact #cdCaptcha a").click(function(){ UtilsForm.modifCaptcha(); }); $("#pageContact form").submit(function(){ UtilsForm.reinitMsgErr($(this)); UtilsForm.verifChamps( $("#Nom").val().length == 0, $("#Nom").parent(), "

Champ obligatoire

"); UtilsForm.verifChamps( $("#Mail1").val().length == 0, $("#Mail1").parent(), "

Champ obligatoire

"); UtilsForm.verifChamps( $("#Mail1").val().length != 0 && !UtilsForm.validMail($("#Mail1").val()), $("#Mail1").parent(), "

Format incorrect

"); UtilsForm.verifChamps( $("#Mail2").val().length == 0, $("#Mail2").parent(), "

Champ obligatoire

"); UtilsForm.verifChamps( $("#Mail2").val().length != 0 && !UtilsForm.validMail($("#Mail2").val()), $("#Mail2").parent(), "

Format incorrect

"); UtilsForm.verifChamps( $("#Texte").val().length == 0, $("#Texte").parent(), "

Champ obligatoire

"); UtilsForm.verifChamps( $("#captcha").val().length == 0, $("#captcha").parent().parent(), "

Champ obligatoire

"); if ( $(".err", $(this)).length > 0 ){ $(".msgErreur", $(this)).html("

Le formulaire contient des erreurs (champ obligatoire, mal formaté, ...).

"); return false; } }); });