On my form, I disabled dates. However, when a user manually keys in a date that is disabled, it seems to clear the input. This then gets passed on to my custom validation rules as a "" (empty string) instead of the date entered. Is there a way to prevent the datepicker from clearing its input when the user keys a disabled date in?
5 Answers, 1 is accepted
Could you please refer to the answer in the support ticket that you have opened for the same issue. As I have mentioned in the ticket, there is inconsistency with the disabled dates and we will further look into it.
Best Regards,
Konstantin Dikov
Telerik
Hi Konstantin,
Received your reply in the ticket, thank you, I will try this out (attaching to the blur event and manually adding back the disabled date value).
Attaching to the blur event does not work; the onChange event fires first, and kendo's onChange handler will wipe out the input before the onBlur works.
Attaching to the onChange event did work; I used the onChange event to store the user input, and then put the value back into the input... but the kendo onChange handler then fired afterwards, changing it to blank, and then overriding my storage variable when my onChange handler reacted. The jQuery event object was slightly different when from user input instead of kendo event handler and I used the presence of a field to distinguish between the two. This feels like a brittle fix and I hope that the engineers decide to not to clear out the field so that the client-side validator can provide user feedback; in my case it is not a required field so the user may not notice when their date is deleted.
$('#StartDate').change(function (e) {
if (e.bubbles) //This is specific to the user's change event.
startDateInput = ($('#StartDate')).val();
});
It seems that the preferred fix will be to keep the input in all cases. You could follow the progress of the item at the following link:
Once again, please excuse us for any inconvenience caused by this.
Regards,
Konstantin Dikov
Telerik