46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
function validate() {
|
|
var allvals = true;
|
|
$("[required]").each(function() {
|
|
if(!$(this).val()) {
|
|
allvals = false;
|
|
$(this).addClass('brsr');
|
|
}
|
|
else { $(this).removeClass('brsr'); }
|
|
});
|
|
if ($('[name=encours]').val()<0 || $('[name=encours]').val()>500 || !$('[name=encours]').val()){
|
|
allvals = false;
|
|
$('[name=encours]').addClass('brsr');
|
|
}
|
|
else { $('[name=encours]').removeClass('brsr'); }
|
|
return allvals;
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
validate();
|
|
});
|
|
|
|
$('[required]').blur(function(){
|
|
validate();
|
|
});
|
|
|
|
$('#dialog').dialog({ buttons: [
|
|
{ text: "Valider", click: function() {
|
|
var values = $(this).find('form').serialize();
|
|
if (validate()) {
|
|
if ($('.loading').css('display')=='none') {
|
|
$('.loading').css('display', 'block');
|
|
$('.ui-dialog-content').css('overflow','hidden');
|
|
$(".ui-dialog-buttonpane button:contains('Valider')").button("disable");
|
|
}
|
|
else { $('.loading').css('display', 'none');}
|
|
$.post('/saisie/scorecutoff', values, function(data) {
|
|
$('#dialog').html(data);
|
|
});
|
|
}
|
|
}},
|
|
{ text: "Fermer", click: function() {
|
|
if($(".message p").text()=='Cut-off mis à jour.') { location.reload(); }
|
|
$(this).dialog('close');
|
|
}
|
|
}
|
|
] }); |