Hi
I need quite a complex validation mechanism as various inputs are related to each other.
I never had problems so far but in my newest application I struggle with the combination of two custom validation rules.
Each rule is applied to an autocomplete input and validation is fired on blur and on various change events. Now, the problem is, that both validation messages are shown on the same input element and not separately for each of them.
Here is my validator setup:
classifiedTaxaValidator = $("#classified_taxa_form").kendoValidator({
validateOnBlur: true,
messages: {
required: "Dieses Feld ist obligatorisch",
subordination: "Diese Unterordnung ist nicht möglich",
correctrank: "Der Name passt nicht zur gewählten Rangstufe"
},
rules: {
correctrank: function (input) {
if (input.is("[id=taxon_names_autocomplete]")) {
console.log('validating name');
// binomial name chosen ?
var nam = input.val();
var parts = nam.split(" ");
var rank_id = $('#taxon_rank_id').val();
// exactly uninomial
if (parts.length === 1) {
return rank_id > 5;
}
// at least binomial name
if (parts.length > 1) {
return rank_id < 6;
}
}
return true;
},
subordination: function (input) {
if (input.is("[id=parent_taxa_autocomplete]")) {
console.log('validating parent taxon');
// rank of current taxon must be lower than rank of parent
var taxonRankId = $('#taxon_rank_id').val();
return taxonRankId < parentTaxonRankId;
}
return true;
}
}
}).data("kendoValidator");
Any idea what I am missing here?
Kind regards
Alex