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

datepicker validator

1 Answer 206 Views
Validation
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 01 Aug 2012, 08:20 AM
hi,
i'm using the kendo datepicker but i want to add a custom validation rule to this.. how do i go about it? if i combine datepicker + validator, the validation is triggered on clicking the date calender button.

1 Answer, 1 is accepted

Sort by
0
Accepted
Iliana Nikolova
Telerik team
answered on 06 Aug 2012, 07:49 AM
Hello David,

You could set a custom validation rules via the rules property of the Kendo UI Validator. For example: 
<div id="MyForm">
  <ul>
    <li>
       <input id="datepicker" required />
    </li>
  </ul>
</div>
 
<script>
   $(document).ready(function() {
      $("#datepicker").kendoDatePicker({});
     
      $("#MyForm").kendoValidator({
        rules: {
          custom: function(input){
            //debugger;
          }
        }
      })   
    });
</script>

Regarding the behavior you have observed ("the validation is triggered on clicking the date calendar button") - I tried to reproduce it, but to no avail. In order to assist you best please provide some more details or even best a small but runnable project which illustrates your scenario. Thank you in advance for your cooperation.

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!
Tags
Validation
Asked by
David
Top achievements
Rank 1
Answers by
Iliana Nikolova
Telerik team
Share this question
or