2011-09-20 07:23:41 +00:00

46 lines
1.2 KiB
JavaScript

$(document).ready(function(){
//Boite de dialog surveillance
$('.dialogsurv').live('click', function(){
var title = $(this).attr('title');
var href = $(this).attr('href');
var dialogOpts = {
bgiframe: true,
title: title,
width: 500,
height: 350,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
$('#dialogsurv').keypress(function(e){
if (e.keyCode == 13){
e.preventDefault();
survSubmit();
}
});
},
buttons: {
Ok: function() { survSubmit(); },
Annuler: function() { $(this).dialog('close'); }
},
close: function() { $('#dialogsurv').remove(); }
};
$('<div id="dialogsurv"></div>').dialog(dialogOpts);
return false;
});
});
function survSubmit(){
var buttons = $('#dialogsurv').dialog('option','buttons');
for( var button in buttons ){
$(":button:contains('"+button+"')").attr('disabled','disabled');
}
var formAction = $('#frmSurv').attr('action');
var href = window.location.href;
var serData = $('#frmSurv').serialize();
$('#frmSurv').replaceWith('<div id="frmSurv">Mise sous surveillance en cours...</div>');
$.post(formAction, serData, function(data) {
$('#frmSurv').html(data);
});
}