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

Champ obligatoire

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

Champ obligatoire

"); UtilsForm.verifChamps( $("#Mail").val().length != 0 && !UtilsForm.validMail($("#Mail").val()), $("#Mail").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; } }); });