


function testform()
{
    txt_email = $("#txtMail").val();
	txt_pseudo = $("#txtPseudo").val();
	txt_pass = $("#txtPass").val();
	txt_texte = $("#TexteFormulaire").val();

	if ( !txt_texte )
	{
		$('#lib_erreur').html("ERREUR : Votre texte est vide. merci d'écrire votre message");
    	return;
    }
	else if ( !txt_pseudo )
	{
		$('#lib_erreur').html("ERREUR : Votre pseudo est vide.");
    	return;
    }
 	else if ( !txt_email )
	{
		$('#lib_erreur').html("ERREUR : Votre email est vide");
    	return;
    }
 	else if ( !txt_pass )
	{
		$('#lib_erreur').html("ERREUR : Votre mot de passe est vide");
    	return;
    }

	  var dataString = 'txt_email=' + txt_email + '&txt_pseudo=' + txt_pseudo + '&txt_pass=' + txt_pass;

	  $.ajax({
	        type: "POST",
	        url: "/forum/process_erreur.php",
	        data: dataString,
	        dataType: "json",
	        error: function(msg){ alert( "Erreur : " + msg );},
	        success: function (data){

	          if ( data.reponse == "ok" )
	          {
	          		$("#EXP_email_value").val(txt_email);
	          		$("#EXP_password_value").val(txt_pass);
	          		$('#formreponse').submit();
	          }
	          else if ( data.reponse == "ko" )
	          {
              		$('#lib_erreur').html(data.erreur);
              }

	        }
	    })

}


$(function() {


$("#id_ecole").change(function () {

      id_formation = parseInt($("#id_ecole").val());

	  var dataString = 'id_formation=' + id_formation;
	  $.ajax({
	        type: "POST",
	        url: "/forum/process_formation.php",
	        data: dataString,
	        dataType: "json",
	        error: function(msg){ alert( "Erreur : " + msg );},
	        success: function (data){

	         $("#id_formation").empty();
	         nb_element = parseInt(data.nb_element);
	         $('#id_formation').append('<option value="0" selected="selected">Aucune formation en particulier</option>');
	         for (i=0;i<nb_element;i++)
  			 {
     		            $('#id_formation').append('<option value="' + data.donnees[i].id + '" selected="selected">' + data.donnees[i].libelle + '</option>');
     		 }
     		  $('#id_formation').val(0);
	        }
	    })

});


});


