does anyone knows how to validate the Kendo UI Multiselect Widget with the Kendo UI validator?
I only want to check if the selections contains something or is empty.
The Multiselect should be required.
Thanks
Given a multiselect defined as:
<select id="tags" multiple="multiple" name="tags" required data-required-msg="Select start time"></select>
and the following JavaScript for initializing it:
var multi = $("#tags").kendoMultiSelect({
dataSource: {
transport: {
read: function (op) {
var data = [
"Option1", "Option2", "Option3", "Option4", "Option5"
];
op.success(data);
}
}
}
}).data("kendoMultiSelect");
Add the following code for validating it:
// Get reference to the validator
var validator = $("#tags").kendoValidator().data("kendoValidator");
// Bind validation to blur
$("input", multi.wrapper).on("blur", function() {
validator.validate();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With