Reputation: 389
I have a datepicker, textbox and validation in their blur event. If validation fails for datepicker I am showing a message to user. But it shows immediately the validation message of textbox. And it becomes recursive.
Message appears all the time. User can't get of the loop unless she kills the page.
(function() {
$("#kendoDatePicker").kendoDatePicker();
$("#kendoDatePicker").on("blur", function() {
if ($(this).data("kendoDatePicker").value() > new Date()) {
alert("Date cannot be greater than today. Please re-enter.");
}
});
$("#kendoTextBox").on("blur", function() {
var sch_time = $('#kendoTextBox').val();
if (sch_time == "") {
alert("Input can't be empty.");
}
});
})();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="http://kendo.cdn.telerik.com/2018.3.911/js/kendo.all.min.js"></script>
<div class="demo-section k-content">
<input id="kendoDatePicker" value="04/04/2017" style="width: 100%" />
<input id="kendoTextBox" value="" style="width: 100%" />
</div>
Fiddle: https://jsfiddle.net/Hd47F/1530/
Upvotes: 0
Views: 47