New to Kendo UI for jQuery? Download free 30-day trial

Prevent Invalid Values

The following example demonstrates how to prevent invalid values in a Kendo UI DateTimePicker.

  <div id="example">
    <div class="demo-section k-header" style="width: 400px;">
      <h4>Select date</h4>
      <input id="datetimepicker" style="width: 200px;"/>
    <div class="box">                
      <h4>Console log</h4>
      <div class="console"></div>
      $(document).ready(function() {
        function onOpen() {

        function onClose() {

        function onChange() {
          $(".console").append("<p>Change :: " + kendo.toString(this.value(), 'd') + "<p>");

          // If you do not want to wire the input change event, uncomment.
          /*if (this.value() === null) {

          change: onChange,
          close: onClose,
          open: onOpen,
          value: new Date()

        // If you do not want to use widget, change the event.
        $("#datetimepicker").on("change", function() {
          var input = $(this);
          var widget ="kendoDateTimePicker");

          if (widget && widget.value() === null && input.val()) {

See Also

In this article
Not finding the help you need? Improve this article