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

Validation for Date using Jquery

1 Answer 47 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Radhika
Top achievements
Rank 1
Radhika asked on 29 Jul 2013, 02:04 PM
hi

  I am using calendar control Type="date".How can i give validation to check whether the given date is in correct format or not.


<div style="margin-top:2px; width:98%;">
      <div class="black-lbl-text-mid"  style="width:55%; padding-left:0px; float:left; text-align:left;">Start Date </div>
    </div>
<div style="float:left; width:98%;" >
      <input id="txtLabourStartDate" type="date"  name="txtLabourStartDate" class="textbox-3" style="width:50%;  float:left; text-align:left;"/>
  </div>

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 31 Jul 2013, 12:08 PM
Hi,

 You can use the kendo.parseDate method to do this. If it returns null then the date is not valid. Here is a quick demo:

var value = $("#txtLabourStartDate").val();

var date = kendo.parseDate(value, "yyyy/MM/dd");

if (date == null) {
   // invalid
}

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
Radhika
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or