'How does kendo form validation custom required work?

I would like to add a required field to a Kendo form. This works with:

validation: { required: true },

If I now want to set required myself in a function, this no longer works.

validation: { 
  required: function(){
             return true;
            }  
},

I have created an example: https://dojo.telerik.com/epEzewIt/5

If no entry is made in the "MultiSelect" field, the required variant as a function is no longer displayed: "MultiSelect is required" when it is empty.

How can I store required with a function?



Solution 1:[1]

if you want to achieve this and to have a event handler, you can use the following code:

validation: {
      validated: function (input) {
         //here you can place your code
         //you need to return true of false
         //e.g
         if(true){ return true; }
         return false;
     
      }
}

I had the same use case, as I was building it dynamically.

As you can see I was able to validate it:

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JasminB