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();
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.