1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<script>
$(document).ready(function () {
//Validation du formulaire avec validate et dialog
var validator = $("#form1").validate({
rules: {
suivi_par: { suivi_par0 : true },
nom_contact: { required: true }
},
messages: {
nom_contact: { required: "Veuillez saisir le nom d'un client" }
},
errorPlacement: function (error, element) {
error.appendTo($("#dialog-error"));
},
invalidHandler: function() {
$("#dialog-error").dialog('open');
},
errorPartainer: "#dialog-error",
errorLabelPartainer: "#dialog-error",
wrapper: 'div',
onfocusout: false,
onclick: false,
// specifying a submitHandler prevents the default submit
submitHandler: function() {
$("#dialog-confirm").dialog("open");
}
});
$("#dialog-error").dialog({
autoOpen: false,
width: 350,
modal: true,
overlay: { backgroundColor: "#000", opacity: 0.5 },
title: 'Message d\'erreur',
resizable: false,
open: function(event, ui) { //Cacher la croix fermer
$(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide();
},
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
//formulaire de boite
$("#dialog-confirm").dialog({
autoOpen: false,
width: 350,
modal: true,
overlay: { backgroundColor: "#000", opacity: 0.5 },
title: 'Message d\'erreur',
resizable: false,
buttons : {
"Oui" : function() {
$("#mettre_jour_dossier").val('1'); //demande mise a jour dossier
$('#form1').submit();
$(this).dialog("close");
},
"Non" : function() {
$('#form1').submit();
$(this).dialog("close");
}
}
});
});
</script> |
Partager