PROBLEM SOLVED: i feel so bad!!!!!
I used the version 0.4.5 of bootstrapValidator and the event 'success.form.bv' can be used in the version 0.5.
i'm using bootstrapValidator and it works fine except when i want to use it with ajax. The documentation speak about that: http://bootstrapvalidator.com/examples/ajax-submit/
The example is clear but it don't work. I don't even have the concole.log('Coucou' diplayed. So my ajax script won't work. However, my ajax script alone work fine.
<script>
$(document).ready(function() {
$('#formNouveauPatient').bootstrapValidator({
message: 'Ce champ n\'est pas valide.',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
nom: {
message: 'Nom incorrect',
validators: {
notEmpty: {
message: 'Le nom est requis et ne peut être vide.'
},
stringLength: {
min: 3,
max: 30,
message: 'Le nom doit au moins contenir 3 caractères.'
},
regexp: {
regexp: /^[a-zA-Z0-9_" "]+$/,
message: 'Le nom ne peut contenir que des lettes/chiffres/underscores'
}
}
},
email: {
validators: {
emailAddress: {
message: 'Ce n\'est pas une adresse email valide.'
}
}
}
}
})
.on('success.form.bv', function(e) {
// Prevent form submission
e.preventDefault();
console.log('Coucou');
});
});
/*
$(function() {
//Fonction gère l'envoi du formulaire ajout de nouveau patient
$("button#nouveauPatient").click(function(){
$.ajax({
type: "POST",
url: "<?php echo WEBROOT; ?>/patient/ajoutPatient",
data: $('form#formNouveauPatient').serialize(),
success: function(msg){
$("#Message").html(msg)
$("#ModalNouveauPatient").modal('hide');
},
error: function(){
alert("Un problème est survenu durant la tentative d\'ajout.");
}
});
});
});
*/
</script>