This question is locked. New answers and comments are not allowed.
Hi
I use the datepicker and I use my own masking script to format the date as mm/dd/yyyy. For example, if a user types 10/12/12 it will be automatically changed to 10/12/2012. I have wired this script to the onblur event. But the problem is, Telerik's date validator kick's in and highlights the field as red and invalid and it prevents from triggering the onchange event which in turn does other processing for me.
So all I want to know is, how do I disable or remove the date validator so that it does not consider 10/12/12 as invalid.
I use the datepicker and I use my own masking script to format the date as mm/dd/yyyy. For example, if a user types 10/12/12 it will be automatically changed to 10/12/2012. I have wired this script to the onblur event. But the problem is, Telerik's date validator kick's in and highlights the field as red and invalid and it prevents from triggering the onchange event which in turn does other processing for me.
So all I want to know is, how do I disable or remove the date validator so that it does not consider 10/12/12 as invalid.
@Html.LabelFor(model => model.SurveyDate)<br />@(Html.Telerik().DatePickerFor(model => model.SurveyDate).Max(System.DateTime.Now.Date).ClientEvents(e => e.OnChange("onSurveyDateChange")).InputHtmlAttributes(new { onblur = "gsFormatDate_blur(this);", maxlength = 10, @class = "textboxInset" })) <br /> @Html.ValidationMessageFor(model => model.SurveyDate)//Function to format Date as the user tabs out of the field.function gsFormatDate_blur(lvParent) { var re = /\D/g; var lvNumber = lvParent.value.replace(re, ""); var lvLength = lvNumber.length; if (lvLength > 2 && lvLength < 5) { var lvSegmentA = lvNumber.slice(0, 2); var lvSegmentB = lvNumber.slice(2, 4); lvParent.value = lvSegmentA + "/" + lvSegmentB; } else { if (lvLength > 4) { var lvSegmentA = lvNumber.slice(0, 2); var lvSegmentB = lvNumber.slice(2, 4); var lvSegmentC = lvNumber.slice(4, 8); if (lvSegmentC.length == 2) { if (lvSegmentC > 30) { lvSegmentC = Number(lvSegmentC) + 1900; } else { lvSegmentC = Number(lvSegmentC) + 2000; } } lvParent.value = lvSegmentA + "/" + lvSegmentB + "/" + lvSegmentC; } else { // If nothing is entered, leave the field blank if (lvLength < 1) { lvParent.value = ""; } lvParent.value = lvNumber; } } return true;}