This is a migrated thread and some comments may be shown as answers.

Please add focus events to the DropDownList

5 Answers 501 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 22 Mar 2012, 09:08 PM
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.

5 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 23 Mar 2012, 03:28 PM
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!
0
Craig
Top achievements
Rank 1
answered on 27 Mar 2012, 09:44 PM
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?
0
Brian
Top achievements
Rank 1
answered on 27 Mar 2012, 10:08 PM
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);
});
0
Craig
Top achievements
Rank 1
answered on 27 Mar 2012, 10:08 PM
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.
0
Craig
Top achievements
Rank 1
answered on 27 Mar 2012, 10:33 PM
$("#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. :)
Tags
DropDownList
Asked by
Brian
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Craig
Top achievements
Rank 1
Brian
Top achievements
Rank 1
Share this question
or