How to limit the from to date range when all day event check box is not selected

2 posts, 1 answers
  1. Indika
    Indika avatar
    13 posts
    Member since:
    Mar 2014

    Posted 16 Jun 2015 Link to this post


    I'm developing a leave management application and I have 2 types of leaves. Full day leave and half day leave. I want to limit the from and to date time pickers to same day if the full day event check box is not clicked in the default popup that appears in the add event popup.

     Currently it shows 1 day difference in from and to date pickers when full day event check box is not clicked and user can select any day with any gap in from and to date pickers. 

     I've tried to do it but failed. Would be grate if someone can help me on doing this.


  2. Answer
    Vladimir Iliev
    Vladimir Iliev avatar
    2156 posts

    Posted 18 Jun 2015 Link to this post

    Hello Indika,

    You need to define custom validation rule and validate the "start" / "end" fields based on the "allDay" field value. This can be done by extending the build-in validation rules as follows:

    //this code block should be added before the Scheduler initialization code
    //it can be used for both the MVC wrapper and Kendo UI
    (function($, kendo) {
      //Extending the Grid build in validator
      $.extend(true, kendo.ui.validator, {
        rules: {
          // Add custom validation rule to validate
          //description field
          description: function(input, params) {
            if ("[name='description']")) {
              if (input.val() != undefined && input.val().length > 0) {
                return true;
              } else {
                return false;
            //check for the rule attribute
            return true;
        messages: { //custom rules messages
          description: function(input) {
            // return the message text
            return "Description field is required!";
    })(jQuery, kendo);

    Vladimir Iliev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET AJAX banner
Back to Top