Skip to content Skip to sidebar Skip to footer

Validation Message Is Not Working Properly For Datetimepicker?

Here issue is to validate the datetimepicker and reset the values after page load. In pageload validation is working properly but datetimepickers values are not reset. After pagel

Solution 1:

In the filter function the value for mindate and maxdate is coming back as null. This is because .data() has not stored the updated value from the datepicker.

I have updated your code to use the value of the datepickers as shown in the fiddle.

http://jsfiddle.net/XHW3w/9/

$("#filter").on("click", function () {
   var mindate = $('#datetimepicker1').val();  // uses the val methodvar maxdate = $('#datetimepicker2').val();  // uses the val methodvar product = $("#products").data("kendoDropDownList").value();
   var order = $("#orders").data("kendoDropDownList").value();

    if (!mindate || !maxdate || !product || !order) {
      var content = "";
       if (!mindate) 
        content += "<div class=\"k-error-colored\">mindate is not defined!</div>";
       if (!maxdate) 
        content += "<div class=\"k-error-colored\">maxdate is not defined!</div>";
       if (!product) 
        content += "<div class=\"k-error-colored\">product is not defined!</div>";
       if (!order) 
        content += "<div class=\"k-error-colored\">order is not defined!</div>";

    $("#filter-msg").data("kendoWindow")
        .content(content)
        .center()
        .open();
    returnfalse;
    }
});

Post a Comment for "Validation Message Is Not Working Properly For Datetimepicker?"