Add has-error CSS class when dates are not ordered + stop checking if first date is not passed
This commit is contained in:
parent
c2f5c4731a
commit
1c8a41dc02
@ -103,7 +103,7 @@
|
||||
|
||||
## Changelog du 21 juin 2011 (pyg@framasoft.net)
|
||||
- très nombreuses modifications CSS
|
||||
- modification adminstuds.php : ajout de classes aux formulaires et ajout de stripslashes à l'affichage (TODO: à généraliser)
|
||||
- modification adminstuds.php : ajout de classes aux formulaires et ajout de stripslashes à l'affichage
|
||||
- modification infos_sondages.php : simplification du tableau de choix, ajouts de CSS, ajouts de labels pour faciliter la selection
|
||||
|
||||
## Changelog version 0.6.7 (mai 2011)
|
||||
|
@ -54,7 +54,7 @@ $(document).ready(function () {
|
||||
|
||||
// creates assoc array for date
|
||||
var df = [];
|
||||
for (var dc = 0; dc < 6; dc++) {
|
||||
for (var dc = 0; dc < dtsplit.length; dc++) {
|
||||
df[dfsplit[dc]] = dtsplit[dc];
|
||||
}
|
||||
|
||||
@ -77,7 +77,6 @@ $(document).ready(function () {
|
||||
var re_id_hours = new RegExp('"d' + (nb_days - 1) + '-h', 'g');
|
||||
var re_name_hours = new RegExp('name="horaires' + (nb_days - 1), 'g');
|
||||
|
||||
// TODO Faire mieux que remplacer des chaines de caractères
|
||||
var new_day_html = last_day.html().replace(re_id_hours, '"d' + nb_days + '-h')
|
||||
.replace('id="day' + (nb_days - 1) + '"', 'id="day' + nb_days + '"')
|
||||
.replace('for="day' + (nb_days - 1) + '"', 'for="day' + nb_days + '"')
|
||||
@ -234,13 +233,16 @@ $(document).ready(function () {
|
||||
var startDate = parseDate(startDateField.val(), window.date_formats.DATE);
|
||||
var endDate = parseDate(endDateField.val(), window.date_formats.DATE);
|
||||
|
||||
console.log('start_date as date', startDate);
|
||||
console.log('start_end as date', endDate);
|
||||
// Clear error classes
|
||||
startDateField.parent().removeClass('has-error');
|
||||
endDateField.parent().removeClass('has-error');
|
||||
|
||||
if (startDate <= endDate && startDate > new Date()) {
|
||||
// console.log('start_date as date', startDate);
|
||||
// console.log('start_end as date', endDate);
|
||||
if (startDate <= endDate) {
|
||||
while (startDate <= endDate) {
|
||||
var dateStr = formatDate(startDate, window.date_formats.DATE);
|
||||
if(!useFirstEmptyDateField(dateStr)) {
|
||||
if (!useFirstEmptyDateField(dateStr)) {
|
||||
newDateFields(dateStr);
|
||||
}
|
||||
startDate.setDate(startDate.getDate() + 1);
|
||||
@ -251,8 +253,11 @@ $(document).ready(function () {
|
||||
endDateField.val('');
|
||||
$('#add_days').modal('hide');
|
||||
submitDaysAvalaible();
|
||||
|
||||
} else {
|
||||
console.log('err');
|
||||
startDateField.parent().addClass('has-error');
|
||||
endDateField.parent().addClass('has-error');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user