Please add focus events to the DropDownList

6 posts, 0 answers
  1. Brian
    Brian avatar
    4 posts
    Member since:
    Jan 2012

    Posted 22 Mar 2012 Link to this post

    I would find it very helpful if the DropDownList triggered the focusin and focusout events on the original select element. This would help jQuery validation to work in a similar manner with the DropDownList  as it does with the native select control.
  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2622 posts

    Posted 23 Mar 2012 Link to this post

    Hello Brian,

    Thank you for sharing your idea with us. This suggestion sounds interesting and it will be revised by our Dev team.

    Your points were updated.


    Kind regards,
    Iliana Nikolova
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Craig
    Craig avatar
    3 posts
    Member since:
    Mar 2012

    Posted 27 Mar 2012 Link to this post

    I'm not sure of the status of this - but this is a major for us.

    We have all form controls validate on blur or keyup etc, the defaults of jquery validate. The dropdownlist control does not validate until submit because it doesn't expose any of the original events of the dropdown list or input box.

    Is there a suitable workaround for this perhaps?
  4. Brian
    Brian avatar
    4 posts
    Member since:
    Jan 2012

    Posted 27 Mar 2012 Link to this post

    I don't know if this is what you want, but this is similar to what I've done in the meantime:

    $('select').each(function(){
        var $select = $(this),
        options {
            open: function() { $select.trigger('focusin'); },
            change: function() { $select.trigger('focusout'); }
        };
        $select.kendoDropDownList(options);
    });
  5. Craig
    Craig avatar
    3 posts
    Member since:
    Mar 2012

    Posted 27 Mar 2012 Link to this post

    change: function(e) {
        // Validate this individual item.
        $("#frm-licensing").validate().element("#notifyperiod");
    }

    Above is the fix I've applied. It's a pain having to do this on any kendo control that doesn't work with validate.

    I tried invoking the change and focus events specifically on the element from within this same event - but that only caused validation once and then failed.
  6. Craig
    Craig avatar
    3 posts
    Member since:
    Mar 2012

    Posted 27 Mar 2012 Link to this post

    $("#formname").kendoDropDownList({
        change: function(e) { $(this.element.context.form).validate().element(this.element); }
    });

    I've updated my code as per above. This way I don't need to reference the element or form by name. :)
Back to Top