368,7 → 368,8 |
"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", |
384,10 → 385,31 |
if (element.type === 'radio') { |
this.findByName(element.name).parent("div").parent("div").removeClass(errorClass).addClass(validClass); |
} else { |
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').text(''); |
$(element).next(" span.help-inline").remove(); |
} |
} |
} |
}); |
$("#form-observateur").validate({ |
rules: { |
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; |
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(val.nom_sci); |
suggestions.push(nom); |
} |
}); |
} |
|
if (suggestions.length >= 50) { |
suggestions.push("..."); |
} |
return suggestions; |
} |
|