368,12 → 368,13 |
"dateCel", |
function (value, element) { |
return /^[0-9]{2}[-\/][0-9]{2}[-\/][0-9]{4}$/.test(value); |
}, "Format : jj/mm/aaaa. Date incomplète, utiliser 0, exemple : 00/12/2011."); |
}, |
"Format : jj/mm/aaaa. Date incomplète, utiliser 0, exemple : 00/12/2011."); |
$.extend($.validator.defaults, { |
errorClass: "control-group error", |
validClass: "control-group success", |
errorElement: "span", |
highlight: function (element, errorClass, validClass) { |
highlight: function(element, errorClass, validClass) { |
if (element.type === 'radio') { |
this.findByName(element.name).parent("div").parent("div").removeClass(validClass).addClass(errorClass); |
} else { |
380,12 → 381,33 |
$(element).parent("div").parent("div").removeClass(validClass).addClass(errorClass); |
} |
}, |
unhighlight: function (element, errorClass, validClass) { |
unhighlight: function(element, errorClass, validClass) { |
if (element.type === 'radio') { |
this.findByName(element.name).parent("div").parent("div").removeClass(errorClass).addClass(validClass); |
} else { |
$(element).parent("div").parent("div").removeClass(errorClass).addClass(validClass); |
$(element).next('span.help-inline').text(''); |
if ($(element).attr('id') == 'taxon') { |
var warningClass = "control-group warning"; |
if ($("#taxon").data("selection") != $("#taxon").val()) { |
$("#taxon").data("selection", ""); |
$("#taxon").data("nn", ""); |
if ($("#taxon").val() != '') { |
$("#taxon-input-groupe").removeClass(validClass) |
.removeClass(errorClass) |
.addClass(warningClass); |
this.showLabel(element, "Nom abscent du référentiel."); |
} |
} else { |
if ($("#taxon").val() != '') { |
$("#taxon-input-groupe").removeClass(warningClass) |
.removeClass(errorClass) |
.addClass(validClass); |
$(element).next(" span.help-inline").remove(); |
} |
} |
} else { |
$(element).parent("div").parent("div").removeClass(errorClass).addClass(validClass); |
$(element).next(" span.help-inline").remove(); |
} |
} |
} |
}); |
411,8 → 433,7 |
}); |
$("#form-obs").validate({ |
rules: { |
date : { |
dateCel: true}, |
date : "dateCel", |
taxon : "required" |
} |
}); |
627,6 → 648,10 |
}, |
html: true |
}); |
$( "#taxon" ).bind("autocompleteselect", function(event, ui) { |
$("#taxon").data("selection", ui.item.value); |
$("#taxon").data("nn", ui.item.nn); |
}); |
} |
|
function getUrlAutocompletionNomsSci(mots) { |
639,14 → 664,23 |
if (data.resultat != undefined) { |
$.each(data.resultat, function(i, val) { |
val.nn = i; |
listeNomsScientifiques[val.nom_sci] = val; |
suggestions.push(val.nom_sci); |
var nom = {}; |
if (suggestions.length >= 20) { |
nom.label = "..."; |
nom.value = $('#taxon').val(); |
nom.nn = ""; |
suggestions.push(nom); |
return false; |
} else { |
nom.label = val.nom_sci; |
nom.value = val.nom_sci; |
nom.nn = val.nn; |
listeNomsScientifiques[val.nom_sci] = val; |
suggestions.push(nom); |
} |
}); |
} |
|
if (suggestions.length >= 50) { |
suggestions.push("..."); |
} |
|
return suggestions; |
} |
|
683,11 → 717,11 |
} |
}, |
_renderItem: function( ul, item) { |
if(listeNomsScientifiques[item.label] != undefined && listeNomsScientifiques[item.label].retenu == "true") { |
if (listeNomsScientifiques[item.label] != undefined && listeNomsScientifiques[item.label].retenu == "true") { |
item.label = "<b>"+item.label+"</b>"; |
} |
|
if(item.label == '...') { |
if (item.label == '...') { |
item.label = "<b>"+item.label+"</b>"; |
} |
|