Message on wrong input

3 posts, 0 answers
  1. Alex
    Alex avatar
    21 posts
    Member since:
    May 2013

    Posted 15 Jan Link to this post


    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 ("[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 ("[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;

    Any idea what I am missing here?

    Kind regards


  2. Dimo
    Dimo avatar
    8322 posts

    Posted 19 Jan Link to this post

    Hello Alex,

    Please ensure that you have set name attributes to all validated elements.

    In addition, you may need to customize the validator messages' position, otherwise they will appear inside the AutoComplete widgets' markup and break their layout.

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Alex
    Alex avatar
    21 posts
    Member since:
    May 2013

    Posted 20 Jan in reply to Dimo Link to this post

    Hi Dimo

    thank you very much for your answer - and sorry - I missed the mandatory name attribute. I use the Autocomplete just to select a value but don't want to send that value with the form. (Instead I send the id of the selected item). Therefore I didn't set a name attribute.

    Kind regards


Back to Top